objective-c - 体系结构armv7的 undefined symbol : “_OBJC_CLASS_$_SRWebSocket”

标签 objective-c websocket compiler-errors armv7 socketrocket

我将SocketRocket用作WebSocket库,已通过cocoabot程序包管理器将其安装在MAC中,用于iOS 6平台。

在appDeligate.m中时,我放置了头文件

#import <SocketRocket/SRWebSocket.h>

在一个函数中,我正在使用:
SRWebSocket *_webSocket
_webSocket.delegate = nil;
[_webSocket close];

_webSocket = [[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"ws://192.168.178.178:6001"]]];
_webSocket.delegate = self;

NSLog(@"Opening Connection...");
[_webSocket open];

在一个独立的项目中,这个工作很好,但是当我将其包含在我的项目中时,会收到以下错误:

Ld /Users/devuser/Library/Developer/Xcode/DerivedData/myProject-fxqgbeafqfsypwclwioqqupwexue/Build/Products/Debug-iphoneos/myProject.app/myProject normal armv7 cd /Users/devuser/Documents/cordovadev/myProject export IPHONEOS_DEPLOYMENT_TARGET=6.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk -L/Users/devuser/Library/Developer/Xcode/DerivedData/myProject-fxqgbeafqfsypwclwioqqupwexue/Build/Products/Debug-iphoneos -F/Users/devuser/Library/Developer/Xcode/DerivedData/myProject-fxqgbeafqfsypwclwioqqupwexue/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Users/devuser/Library/Developer/GStreamer/iPhone.sdk -filelist /Users/devuser/Library/Developer/Xcode/DerivedData/myProject-fxqgbeafqfsypwclwioqqupwexue/Build/Intermediates/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/armv7/myProject.LinkFileList -miphoneos-version-min=6.0 -dead_strip -lresolv -lstdc++ -framework CoreAudio -framework AudioToolbox -framework VideoToolbox -framework OpenGLES -framework AssetsLibrary -framework QuartzCore -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak_framework CoreMotion -weak-lSystem -force_load /Users/devuser/Library/Developer/Xcode/DerivedData/myProject-fxqgbeafqfsypwclwioqqupwexue/Build/Products/Debug-iphoneos/libCordova.a -ObjC -fobjc-link-runtime -framework GStreamer -lresolv -weak_framework CoreMedia -framework CoreVideo -framework OpenGLES /Users/devuser/Library/Developer/Xcode/DerivedData/myProject-fxqgbeafqfsypwclwioqqupwexue/Build/Products/Debug-iphoneos/libCordova.a -liconv -framework CoreMotion -framework CoreLocation -framework ImageIO -framework OpenAL -framework AssetsLibrary -framework Foundation -weak_framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -framework AudioToolbox -weak_framework AVFoundation -framework CFNetwork -framework MediaPlayer -framework QuartzCore -framework SystemConfiguration -framework MobileCoreServices -lPods-myProject -Xlinker -dependency_info -Xlinker /Users/devuser/Library/Developer/Xcode/DerivedData/myProject-fxqgbeafqfsypwclwioqqupwexue/Build/Intermediates/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/armv7/myProject_dependency_info.dat -o /Users/devuser/Library/Developer/Xcode/DerivedData/myProject-fxqgbeafqfsypwclwioqqupwexue/Build/Products/Debug-iphoneos/myProject.app/myProject

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_SRWebSocket", referenced from: objc-class-ref in AppDelegate.o

ld: symbol(s) not found for architecture armv7

clang: error: linker command failed with exit code 1 (use -v to see invocation)



我已经检查了一下,但是找不到任何相关的东西。有什么帮助吗?

最佳答案

我必须将套接字库链接到“构 build 置”。

我添加的项目->构 build 置->其他链接器标志->调试/发布

-奥比西
-l SocketRocket
-l icucore
框架CFNetwork
框架安全

现在可以正常工作了!

关于objective-c - 体系结构armv7的 undefined symbol : “_OBJC_CLASS_$_SRWebSocket” ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35406230/

相关文章:

ios - 从 Raspberry Pi 到 iPhone 的实时数据

go - 如何向池中的所有连接发送消息

function - 在fortran中的另一个函数内定义函数时出错

objective-c - 以一对多关系从核心数据中获取所有对象

ios - 如何根据第一次加载来加载TabBarController或UIViewController

node.js - 允许公共(public) IP 通过 WebSockets 连接

c - GSL 多个错误处理程序定义链接时出错

C++ 错误 : expected ‘,’ or ‘...’ before ‘distances’

ios - Objective-c 蓝牙说它已连接但 CBCentralManager 没有发现它

iphone - 委托(delegate)在 Controller A 中工作,但不在 Controller B 中工作