2015-09-27 76 views
0

我正在嘗試測試我的應用程序,並且沒有在'Debug_Test'配置上重複'調試'來更改環境。我使用宏來更改源代碼。未找到Apple Match-O鏈接器錯誤庫Xcode 6.4

我已將預處理宏添加到'Debug_test',並將'Run'和'Test'模式更改爲'Debug_Test'。 我測試過了,但是我得到了下面提到的錯誤。

Ld /Users/Kuma/Library/Developer/Xcode/DerivedData/TestClient-arjbprptvrrztsesaxtkhhsypwyc/Build/Products/Debug_Test-iphonesimulator/ShareEx.appex/ShareEx normal x86_64 
cd /Users/Kuma/Desktop/Test/TestClient 
export IPHONEOS_DEPLOYMENT_TARGET=8.4 
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -L/Users/Kuma/Library/Developer/Xcode/DerivedData/TestClient-arjbprptvrrztsesaxtkhhsypwyc/Build/Products/Debug_Test-iphonesimulator -F/Users/Kuma/Library/Developer/Xcode/DerivedData/TestClient-arjbprptvrrztsesaxtkhhsypwyc/Build/Products/Debug_Test-iphonesimulator -filelist /Users/Kuma/Library/Developer/Xcode/DerivedData/TestClient-arjbprptvrrztsesaxtkhhsypwyc/Build/Intermediates/TestClient.build/Debug_Test-iphonesimulator/ShareEx.build/Objects-normal/x86_64/ShareEx.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/../../Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lAFNetworking -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit -e _NSExtensionMain -fobjc-arc -fobjc-link-runtime -fapplication-extension -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.4 -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/Kuma/Library/Developer/Xcode/DerivedData/TestClient-arjbprptvrrztsesaxtkhhsypwyc/Build/Intermediates/TestClient.build/Debug_Test-iphonesimulator/ShareEx.build/ShareEx.appex.xcent -framework ShareExtensionEmbedded -lPods-ShareEx -Xlinker -dependency_info -Xlinker /Users/Kuma/Library/Developer/Xcode/DerivedData/TestClient-arjbprptvrrztsesaxtkhhsypwyc/Build/Intermediates/TestClient.build/Debug_Test-iphonesimulator/ShareEx.build/Objects-normal/x86_64/ShareEx_dependency_info.dat -o /Users/Kuma/Library/Developer/Xcode/DerivedData/TestClient-arjbprptvrrztsesaxtkhhsypwyc/Build/Products/Debug_Test-iphonesimulator/ShareEx.appex/ShareEx 

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

當然,在更改模式之前,我可以構建並添加AFNetworking到我的AppExtension。
我認爲還需要其他設置。但是,我是初學者,不知道設置。

如果有人知道解決方案,請告訴我。

+0

我用的CocoaPods安裝AFNetworking。我也認爲豆莢會造成這個問題。 – penlight

+0

我已經更新了我的答案,可能會對你有所幫助。 – BHUMICA

回答

0

我能用下面的代碼解決同樣的問題。

將此添加到Build Settings中的庫搜索路徑中,並確保選擇遞歸,刪除可能是絕對路徑的其他庫路徑。

$(PROJECT_DIR) 

可能會幫助你。

1

首先,請確保在您的目標的Build Phase選項卡中添加AFNetworking庫。如果它已經存在,請刪除並重新添加。

enter image description here

,確保您Library Search Path設置正確:

enter image description here

+0

謝謝你的回答。 – penlight

+0

但是,我還沒有建立。我做第一件事。但是,我不知道什麼是正確的道路。我看看我的應用程序擴展的「庫搜索路徑」,我發現庫搜索路徑顯示$(繼承)和$(PROJECT_DIR)/ build/Debug-iphoneos。我刪除$(PROJECT_DIR)/ build/Debug-iphoneos並運行測試,但構建失敗。當我也設置$(PROJECT_DIR)/ build/Debug_Test-iphoneos時,編譯失敗並顯示「ld:warning:directory」找不到選項'-L/Users/Kuma/Desktop/Test/TestClient/build/Debug_Test-iphoneos' 」。如果您有任何問題,請告訴我。 – penlight