本文翻译自:library not found for -lPods
I got an error when archiving a project. 归档项目时出错。 This is my environment. 这是我的环境。
- Mac OS Lion Mac OS Lion
- Xcode 4.3.1 Xcode 4.3.1
- iOS SDK 5.1 iOS SDK 5.1
The project deployment target is: 项目部署目标是:
IPHONEOS_DEPLOYMENT_TARGET 3.2
The error shows: 错误显示:
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I guess Pods is CocoaPods that I used to manage XCode project dependencies. 我想Pods是我用来管理XCode项目依赖项的CocoaPods。 https://github.com/CocoaPods/CocoaPods https://github.com/CocoaPods/CocoaPods
This is my Podfile 这是我的Podfile
platform :ios
dependency 'libPusher', '1.1'
I am not sure what the error means? 我不确定错误是什么意思?
#1楼
参考:https://stackoom.com/question/fO28/找不到-lPods的库
#2楼
Did you create 'Distribution' or similar configuration to make Ad-Hoc and App Store archives? 您是否创建了“分发”或类似配置来制作Ad-Hoc和App Store档案? Like many others I followed Apple's recommendations and dubbed 'Release' configuration, called it 'Distribution' and set different signing rules to it. 像许多其他人一样,我遵循Apple的建议并称之为“发布”配置,称为“发布”并为其设置不同的签名规则。 Well, maybe that was a recommendation before they introduced schemes and "Distribute" option in Organizer, anyway, I just had it from before. 好吧,也许这是他们在组织者中引入方案和“分发”选项之前的建议,无论如何,我刚刚从之前获得过它。
Then I had same problem with Pods. 然后我和Pods有同样的问题。 It all worked well when debugging, but archiving failed with link error. 调试时一切运行良好,但归档失败,链接错误。 After trying this and that I changed Archive configuration of my original project from 'Distribution' to 'Release' and the link error was gone. 尝试此操作后,我将原始项目的存档配置从“分发”更改为“发布”,链接错误消失了。
Yet the archive did not show up in Organizer, though I could locate it in file system, but it had 0 size. 然而,存档没有显示在Organizer中,虽然我可以在文件系统中找到它,但它有0大小。
Final step to fix all this was to change "Skip Install" setting for 'Release' configuration to "NO". 修复所有这一切的最后一步是将“释放”配置的“跳过安装”设置更改为“否”。 Note, that you have to do this only for your main project, but not for Pods project. 请注意,您必须仅为主项目执行此操作,而不是为Pods项目执行此操作。 Better leave Pods project as is, since it's generated every time you run 'pod install'. 最好保留Pods项目,因为每次运行“pod install”时都会生成它。
Update Just got an answer from CocoaPods devs It doesn't seem to work for me, since I had Pods configuration properly set. 更新刚从CocoaPods devs得到答案它似乎对我不起作用,因为我正确设置了Pods配置。 But it could help someone else. 但它可以帮助别人。
#3楼
I ran into a similar problem today. 我今天遇到了类似的问题。
- I setup a new project 我设置了一个新项目
- I installed cocoa pods 我安装了可可豆荚
- I created a new configuration
Preview
along with the existingDebug
andRelease
我创建了一个新的配置Preview
以及现有的Debug
和Release
Now when compiling on this new
Preview
configuration, the compiler would not be able to link with Pods and giving me this message: 现在,在编译这个新的Preview
配置时,编译器将无法与Pod链接并向我发送以下消息:ld: library not found for -lPods
The solution: 解决方案:
What I had to do was to run 我要做的就是奔跑
pod install
again and thus configuring cocoapods for the new Preview
configuration. 再次,从而为新的Preview
配置配置cocoapods。 It updated my project, the workspace and the Pod's project file and the problem disappeared 它更新了我的项目,工作区和Pod的项目文件,问题就消失了
#4楼
确保打开.xcworkspace
,而不是.xcodeproj
#5楼
Only adding the "Library Search Paths" (in Build Settings of 'MyProject') to "Pods/build/Debug-iphonesimulator" worked for me (when using the simulator). 只有将“库搜索路径”(在“MyProject”的构建设置中)添加到“Pods / build / Debug-iphonesimulator”才能为我工作(使用模拟器时)。
Got it from here: https://github.com/CocoaPods/CocoaPods/issues/121#issuecomment-5452473 从这里得到它: https : //github.com/CocoaPods/CocoaPods/issues/121#issuecomment-5452473
#6楼
尝试打开xcworkspace文件而不是xcodeproj文件