将OpenTok框架添加到我的项目中

时间:2015-12-01 16:09:00

标签: ios objective-c xcode frameworks opentok

所以我试图将OpenTok框架添加到我的代码中。我正在从https://tokbox.com/developer/sdks/ios/下载IOS SDK然后我将opentok.framwork文件拖到我的框架列表中。当我构建我的代码时,它失败并出现此错误:

Ld /Users/hussein/Library/Developer/Xcode/DerivedData/SocieteGeneral-hiagtpmptjkrqjbabjxpjmnshezi/Build/Intermediates/SocieteGeneral.build/Debug-iphoneos/SocieteGeneral.build/Objects-normal/arm64/SocieteGeneral normal arm64
cd /Users/hussein/Projects/ios-client
export IPHONEOS_DEPLOYMENT_TARGET=5.1.1
export PATH="/Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode 2.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode\ 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode\ 2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -L/Users/hussein/Library/Developer/Xcode/DerivedData/SocieteGeneral-hiagtpmptjkrqjbabjxpjmnshezi/Build/Products/Debug-iphoneos -L/opt/vagrant/embedded/lib -F/Users/hussein/Library/Developer/Xcode/DerivedData/SocieteGeneral-hiagtpmptjkrqjbabjxpjmnshezi/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Users/hussein/Projects/ios-client -filelist /Users/hussein/Library/Developer/Xcode/DerivedData/SocieteGeneral-hiagtpmptjkrqjbabjxpjmnshezi/Build/Intermediates/SocieteGeneral.build/Debug-iphoneos/SocieteGeneral.build/Objects-normal/arm64/SocieteGeneral.LinkFileList -miphoneos-version-min=5.1.1 -dead_strip -force_load -ObjC -mthumb -fobjc-arc -lsqlite3.0 -fobjc-arc -fobjc-link-runtime -framework GLKit -framework VideoToolbox -framework OpenTok -liconv -lstdc++.6.0.9 -lsqlite3 -framework LocalAuthentication /Users/hussein/Library/Developer/Xcode/DerivedData/SocieteGeneral-hiagtpmptjkrqjbabjxpjmnshezi/Build/Products/Debug-iphoneos/libCorePlot-CocoaTouch.a -framework MobileCoreServices -framework CoreText -weak_framework AdSupport -framework CoreAudio -weak_framework Social -framework QuartzCore -framework CoreGraphics -weak_framework Accounts -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework CFNetwork -framework CoreVideo -framework ImageIO -framework Foundation -framework MessageUI -framework OpenGLES -framework Twitter -framework AVFoundation -framework CoreMedia -framework CoreData -framework CoreFoundation -framework MapKit -framework CoreLocation -framework CoreTelephony -framework Security -framework SystemConfiguration -framework UIKit -Xlinker -dependency_info -Xlinker /Users/hussein/Library/Developer/Xcode/DerivedData/SocieteGeneral-hiagtpmptjkrqjbabjxpjmnshezi/Build/Intermediates/SocieteGeneral.build/Debug-iphoneos/SocieteGeneral.build/Objects-normal/arm64/SocieteGeneral_dependency_info.dat -o /Users/hussein/Library/Developer/Xcode/DerivedData/SocieteGeneral-hiagtpmptjkrqjbabjxpjmnshezi/Build/Intermediates/SocieteGeneral.build/Debug-iphoneos/SocieteGeneral.build/Objects-normal/arm64/SocieteGeneral

ld: file not found: -ObjC
clang: error: linker command failed with exit code 1 (use -v to see invocation)

3 个答案:

答案 0 :(得分:0)

好的,问题有点复杂: 当您在项目中拖动库时,会弄乱链接器的标记(您可以在构建阶段 - >其他链接器标志中看到它们),现在当cocoaPods成功添加OpenTok时(我尝试过,我没有错误)它仍然有标志(有错误)。 现在复杂的部分:很难知道哪些标志会导致问题。

(即使你删除-Objc标志,问题可能来自其他标志,因为:  你得到一些遗传的,  你的项目可能需要这个标志,  修改它们可能会产生其他错误 等等) ,并且“重置”你的标志不能在xCode中完成。

所以最好的解决方案是:创建一个新项目,添加cocoapods OpenTok

platform :ios, '8.0'
use_frameworks!

target 'app' do
pod 'OpenTok', '~> 2.6'
end

target 'appTests' do
pod 'OpenTok', '~> 2.6'
end

target 'appUITests' do
pod 'OpenTok', '~> 2.6'
end

和我的桥接导入:

#import "OpenTok/OpenTok.h"

使用默认设置和cocoapod查看新项目中是否仍有错误,如果没有在新项目中拖动您的先前项目文件

答案 1 :(得分:0)

尝试在Build settings

中添加otherLinkerFlags

Build Settings

试试这个!并检查部署目标,使其成为iOS 8.0或更高版本。

答案 2 :(得分:0)

由于启用了bitcode,您可能会收到此错误。 尝试设置启用bitcode“否”

转到目标 - >构建设置 - >搜索“启用Bitcode” - >设为“否”

这解决了我的问题。

Add all frameworks said in docs as well