xcode Cocoa Pods 在调试模式下运行时无法链接库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27188602/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cocoa Pods failed to link libraries while running in the debug mode?
提问by Narender Tak
I m using pods
to link libraries like AfNetworking
, facebook
etc. and its working great in release
mode but I want to check Variables value by debugging but it shows all the variables nil in release mode. I tried to run in debug
mode by editing schema but it failed to compile showing various libraries not found error.
我正在使用pods
链接库等AfNetworking
,facebook
并且它在release
模式下运行良好,但我想通过调试检查变量值,但它在发布模式下显示所有变量 nil。我试图debug
通过编辑模式在模式下运行,但它无法编译显示各种库未找到错误。
EditI have tried updating the architectures.....but this isn't helping out. Error log in debug mode
编辑我试过更新架构......但这无济于事。 调试模式下的错误日志
ld: warning: directory not found for option '-L/Users/madept/Desktop/personally/Pods/build/Debug-iphoneos'
ld: warning: ignoring file /Users/madept/Desktop/personally/libCloudinary.a, missing required architecture x86_64 in file /Users/madept/Desktop/personally/libCloudinary.a (3 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AFHTTPRequestOperation", referenced from:
objc-class-ref in ZRAPIClient.o
"_OBJC_CLASS_$_AFHTTPRequestSerializer", referenced from:
objc-class-ref in ZRAPIClient.o
"_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from:
objc-class-ref in ZRAPIClient.o
"_OBJC_CLASS_$_BITHockeyManager", referenced from:
objc-class-ref in ZRAppDelegate.o
"_OBJC_CLASS_$_CLCloudinary", referenced from:
objc-class-ref in ZRMediaManager.o
"_OBJC_CLASS_$_CLTransformation", referenced from:
objc-class-ref in ZRMediaManager.o
"_OBJC_CLASS_$_DDFileLogger", referenced from:
objc-class-ref in Zooplr.o
"_OBJC_CLASS_$_DDLog", referenced from:
objc-class-ref in Chat.o
objc-class-ref in ZRManagedObject.o
objc-class-ref in ZRTelescopingScrollView.o
objc-class-ref in ZRAddMessageBarController.o
objc-class-ref in ZRCreateAccountViewController.o
objc-class-ref in ZRAddressBookHelper.o
objc-class-ref in Zooplr.o
...
"_OBJC_CLASS_$_DDTTYLogger", referenced from:
objc-class-ref in Zooplr.o
"_OBJC_CLASS_$_ELCAlbumPickerController", referenced from:
objc-class-ref in ZRMediaCaptureController.o
"_OBJC_CLASS_$_ELCImagePickerController", referenced from:
objc-class-ref in ZRMediaCaptureController.o
"_OBJC_CLASS_$_EZAudioPlotGL", referenced from:
objc-class-ref in ZRMediaCaptureController.o
"_OBJC_CLASS_$_EZMicrophone", referenced from:
objc-class-ref in ZRMediaCaptureController.o
"_OBJC_CLASS_$_EZRecorder", referenced from:
objc-class-ref in ZRMediaCaptureController.o
"_OBJC_CLASS_$_FBAppCall", referenced from:
objc-class-ref in ZRAppDelegate.o
"_OBJC_CLASS_$_FBErrorUtility", referenced from:
objc-class-ref in ZRSocialClient.o
"_OBJC_CLASS_$_FBRequest", referenced from:
objc-class-ref in ZRSocialClient.o
"_OBJC_CLASS_$_FBRequestConnection", referenced from:
objc-class-ref in ZRSocialClient.o
"_OBJC_CLASS_$_FBSession", referenced from:
objc-class-ref in ZRAppDelegate.o
objc-class-ref in ZRSocialClient.o
"_OBJC_CLASS_$_Mixpanel", referenced from:
objc-class-ref in ZRAnalyticsTracker.o
objc-class-ref in Zooplr.o
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in Zooplr.o
"_OBJC_CLASS_$_SSKeychain", referenced from:
objc-class-ref in ZRAuthManager.o
"_OBJC_CLASS_$_SVProgressHUD", referenced from:
objc-class-ref in ZRAccountEditViewController.o
objc-class-ref in ZRAppDelegate.o
"_OBJC_CLASS_$_SocketIO", referenced from:
objc-class-ref in ZRChatSocketClient.o
"_OBJC_CLASS_$_TTTAttributedLabel", referenced from:
objc-class-ref in ZRBubbleViewTextMessage.o
"_kReachabilityChangedNotification", referenced from:
-[ZRAppDelegate application:didFinishLaunchingWithOptions:] in ZRAppDelegate.o
-[ZRChatSocketClient init] in ZRChatSocketClient.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help or suggestion would be appreciated.
任何帮助或建议将不胜感激。
回答by Hugues Duvillier
if the above answer didn't work for you, maybe the problem comes from when you installed the pods. Check if you had such message when running pod install
如果上述答案对您不起作用,则问题可能出在安装 pod 时。检查你在运行时是否有这样的消息pod install
The ProjectName [Release] target overrides the
OTHER_LDFLAGS
build setting defined in `Pods/Target Support Files/ProjectName/Pods-ProjectName.release.xcconfig'. This can lead to problems with the CocoaPods installation
ProjectName [Release] 目标覆盖了
OTHER_LDFLAGS
在 `Pods/Target Support Files/ProjectName/Pods-ProjectName.release.xcconfig' 中定义的构建设置。这可能会导致 CocoaPods 安装出现问题
or a similar message but with debug
instead of release (or both).
If so, delete the pod project in your workspace in Xcode, then follow the answer to this question The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig, I past it here :
或类似的消息,但使用debug
而不是发布(或两者兼而有之)。如果是这样,请在 Xcode 中删除您工作区中的 pod 项目,然后按照此问题的答案The target ... overrides the `OTHER_LDFLAGS` build setting 定义在 `Pods/Pods.xcconfig,我在这里过去:
This definitely works most of the time:
Go to your target Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line.
这在大多数情况下肯定有效:
转到您的目标构建设置 -> 其他链接器标志 -> 双击 . 将 $(inherited) 添加到新行。
And then run pod install
again. It did it for me.
然后pod install
再次运行。它为我做到了。
回答by l0gg3r
This means static libraries that you're using do not support x86_64 architecture,
So
这意味着您使用的静态库不支持 x86_64 架构,
所以
- Open "Build Settings" for "Pods" target, and add "x86_64" architecture (in "Architectures" and "Valid Architectures" section).
- Set "Build Active Architectures Only" to "NO".
- Clean "Pods" target.
- Build your target.
- 打开“Pods”目标的“Build Settings”,并添加“x86_64”架构(在“Architectures”和“Valid Architectures”部分)。
- 将“仅构建活动架构”设置为“否”。
- 清理“Pods”目标。
- 建立你的目标。
回答by RuiKQ
Delete the .a files in /Users/YourName/Library/Developer/Xcode/DerivedData/YourProject/Build/Products/Debug-iphoneos. Then clean and build.This help me.
删除 /Users/YourName/Library/Developer/Xcode/DerivedData/YourProject/Build/Products/Debug-iphoneos 中的 .a 文件。然后清理并构建。这对我有帮助。
回答by ?ukasz Szpyrka
What worked for me is adding $(inherited) to:
对我有用的是将 $(inherited) 添加到:
- OTHER_LDFLAGS
- OTHER_CFLAGS
- FRAMEWORK_SEARCH_PATHS
- GCC_PREPROCESSOR_DEFINITIONS
- OTHER_LDFLAGS
- OTHER_CFLAGS
- FRAMEWORK_SEARCH_PATHS
- GCC_PREPROCESSOR_DEFINITIONS
Tip: Inside Build Settings -> (search bar) -> type options above and add $(inherited)
提示:在 Build Settings -> (search bar) -> 上面输入选项并添加 $(inherited)
回答by Arvind YADAV
I had deleted the .a file, it won't worked for me, but when I Deleted the Project Folder in /Users/YourName/Library/Developer/Xcode/DerivedData/YourProject. This help me.
我删除了 .a 文件,它对我不起作用,但是当我删除 /Users/YourName/Library/Developer/Xcode/DerivedData/YourProject 中的项目文件夹时。这对我有帮助。