【问题标题】:Apple Match-O Linker Error library not found Xcode 6.4Apple Match-O Linker Error library not found Xcode 6.4
【发布时间】:2015-12-24 13:50:27
【问题描述】:

我正在尝试测试我的应用程序,但我确实将配置上的“调试”复制到“调试_测试”以更改环境。我使用宏来更改源代码。

我已将预处理器宏添加到“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。
我认为需要其他设置。但是,我是初学者,不知道设置。

如果有人知道解决方案,请告诉我。

【问题讨论】:

  • 我使用 cocoapods 来安装 AFNetworking。我也认为 pod 会解决这个问题。
  • 我已经更新了我的答案可能会对你有所帮助。

标签: ios xcode xcode6


【解决方案1】:

我可以用下面的代码解决同样的问题。

将此添加到构建设置中的库搜索路径,并确保选择递归,删除其他可能是绝对路径的库路径。

$(PROJECT_DIR) 

也许对你有帮助。

【讨论】:

    【解决方案2】:

    首先,请确保在目标的Build Phase 标签中添加AFNetworking 库。如果已经存在,请删除并重新添加。

    第二,确保你的Library Search Path设置正确:

    【讨论】:

    • 但是,我还不能构建。我做第一件事。但是,我不知道什么是正确的路径。我查看了我的应用程序扩展的“库搜索路径”,我发现库搜索路径显示 $(inherited) 和 $(PROJECT_DIR)/build/Debug-iphoneos。我删除 $(PROJECT_DIR)/build/Debug-iphoneos 并运行测试,但构建失败。当我还设置 $(PROJECT_DIR)/build/Debug_Test-iphoneos 时,构建失败并显示“ld: warning: directory not found for option '-L/Users/Kuma/Desktop/Test/TestClient/build/Debug_Test-iphoneos' ”。如果您有任何意见,请告诉我。
    猜你喜欢
    • 2014-10-05
    • 1970-01-01
    • 1970-01-01
    • 2018-05-11
    • 1970-01-01
    • 2014-08-16
    • 2010-11-24
    • 1970-01-01
    • 2013-02-12
    相关资源
    最近更新 更多