Cocoapods - 无法找到以下文件:-lPods / -lPods不是目标文件(库中不允许)

时间:2014-04-15 17:39:07

标签: ios static-libraries static-linking cocoapods

我有一个没有构建的iOS静态库。它使用cocoapods来管理许多依赖项以及作为pod本身。

有趣的是,当库在客户端项目中用作pod时,一切都编译得很好。

以下是我的错误输出:

Libtool /Users/Bob/Library/Developer/Xcode/DerivedData/MyLibrary-fxukfghqxapkcqcnjjhmhecxahhg/Build/Intermediates/MyLibrary.build/Debug-iphoneos/MyLibrary.build/Objects-normal/armv7/libMyLibrary.a normal armv7
    cd /Users/Bob/Projects/MyLibrary
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only armv7 -syslibroot /Users/Bob/Projects/Xcode\ SDKs/iPhoneOS6.1.sdk -L/Users/Bob/Library/Developer/Xcode/DerivedData/MyLibrary-fxukfghqxapkcqcnjjhmhecxahhg/Build/Products/Debug-iphoneos -filelist /Users/Bob/Library/Developer/Xcode/DerivedData/MyLibrary-fxukfghqxapkcqcnjjhmhecxahhg/Build/Intermediates/MyLibrary.build/Debug-iphoneos/MyLibrary.build/Objects-normal/armv7/MyLibrary.LinkFileList -ObjC -framework SystemConfiguration -framework Security -framework CoreGraphics -framework CoreText -framework CoreLocation -framework UIKit -framework QuartzCore -framework Foundation -lPods -o /Users/Bob/Library/Developer/Xcode/DerivedData/MyLibrary-fxukfghqxapkcqcnjjhmhecxahhg/Build/Intermediates/MyLibrary.build/Debug-iphoneos/MyLibrary.build/Objects-normal/armv7/libMyLibrary.a

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods is not an object file (not allowed in a library)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1

我可以做什么/我应该提供哪些其他信息?

2 个答案:

答案 0 :(得分:20)

我的问题是我使用格式为

的pod文件
platform :ios, '6.0'
pod 'AFNetworking'

platform :ios, '6.0'
target 'myproject' do
    pod 'AFNetworking'
end

将libPods.a更改为lib-myproject.a。项目文件仍在尝试链接libPoda.a,但不再存在并导致错误。从构建阶段的框架部分的链接中删除libPods.a。

答案 1 :(得分:0)

在Google项目中查看此答案:https://groups.google.com/forum/?fromgroups=#!topic/cocoapods/DOVaKHXzfnI

基本上,我认为您应该在build phasestarget dependencies中的mb中正确链接两个库。如果您提供有关当前配置的更多信息,我可以更准确地说。