我使用SocketRocket作为WebSocket库,我通过MAC中的cocoabot包管理器为iOS 6平台安装。
在appDeligate.m中我放了头文件
#import <SocketRocket/SRWebSocket.h>
并在函数I中使用:
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 正常的armv7 cd / Users / devuser / Documents / cordovadev / myProject export IPHONEOS_DEPLOYMENT_TARGET = 6.0 export PATH =&#34; /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/ usr / local /箱:在/ usr / bin中:/ bin中:/ usr / sbin目录:/ sbin目录&#34; /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 /用户/ devuser的/库/开发商/ Xcode中/ DerivedData / myProject的-fxqgbeafqfsypwclwioqqupwexue /编译/产品/调试-的iPhoneOS -F /用户/ devuser的/库/开发商/ Xcode中/ DerivedData / myProject的-fxqgbeafqfsypwclwioqqupwexue /编译/产品/调试-的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 基金会-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
架构armv7的未定义符号:
&#34; _OBJC_CLASS _ $ _ SRWebSocket&#34;,引自: AppDelegate.o中的objc-class-refld:找不到架构armv7的符号
clang:错误:链接器命令失败,退出代码为1(使用-v查看 调用)
我已经检查过,但我找不到任何相关内容。有什么帮助吗?
答案 0 :(得分:2)
我必须将套接字库链接到Build Settings。
项目 - &gt;构建设置 - &gt;其他链接器标志 - &gt;调试/发布我添加
-ObjC -l SocketRocket -l icucore -framework CFNetwork - 框架安全性
现在它正在运作!