CocoaPods没有在pod安装上创建Pods.xcconfig

时间:2014-02-18 07:05:38

标签: ios ruby cocoapods

CocoaPods不再为我的项目在Pods.xcconfig上自动创建pod install文件。该文件在项目工作区内以红色字体显示,不在Pods/目录中。

我的Podfile看起来像这样:

platform :ios, '7.0'

target "ProjectName" do

    # Team Created Pods - kept and versioned in private spec repo
    pod 'ProjectImageObject', '0.1.0'
    pod 'Image+Bundle+Name', '0.1.0'

    # Team Forked Pods - kept and versioned in private spec Repo
    pod 'MagicalRecord', '2.2.1-pn'

    pod 'KeychainItemWrapper', '0.1.0'
    pod 'DCRoundSwitch', '0.1.0'
    pod 'JBSignatureController', '0.1.0'
    pod 'MBProgressHUD', '0.5.1-pn'
    pod 'PKRevealController', '1.1.0-pn'
    pod 'SMCalloutView', '2.0'
    pod 'SVPullToRefresh', '0.4.2-pn'
    pod 'TimesSquare', '1.1.0-pn'
    pod 'XMLReader', '0.1.0'

    # Third-Party Pods
    pod 'Reachability', '~> 3.1.1'
    pod 'AFNetworking', '~> 2.1'
    pod 'TTTAttributedLabel', '~>1.8'
    pod 'TPKeyboardAvoiding', '~> 1.2.3'
end

target "ProjectNameTests" do

    # Team Created Pods - kept and versioned in private spec rep
    pod 'SharedTestCore'

    # Third-Party Pods
    pod 'OCHamcrest', '~> 3.0.1'
    pod 'OCMockito', '~> 1.1.0'
end

当我通过终端运行pod install时,不会抛出任何错误。奇怪的是,Pods-ProjectName.xcconfig已经创建。

我需要做些什么来修复CocoaPods以自动创建Pods.xcconfig文件?

到目前为止我尝试过的事情:

  • 再次运行pod install
  • 删除Pods/目录,Podfile.lock,项目workspace以及正在运行pod install
  • 验证所有search paths都是默认值(CocoaPods帮助指南提到这可能会导致问题吗?)

1 个答案:

答案 0 :(得分:7)

最初,我没有在target "ProjectName"中指定Podfile包装器。相反,我只是

# Team Created Pods - kept and versioned in private spec repo
pod 'ProjectImageObject', '0.1.0'
pod 'Image+Bundle+Name', '0.1.0'

# Team Forked Pods - kept and versioned in private spec Repo
pod 'MagicalRecord', '2.2.1-pn'
# ... and so on ...

因此,Pods.xcconfig(针对universal广告连播列表)已创建,libPods.a已添加到Link binary with library目标的ProjectName构建阶段。< / p>

后来,我把这个块包裹在target "ProjectName" do中,即

target "ProjectName" do

    # Team Created Pods - kept and versioned in private spec repo
    pod 'ProjectImageObject', '0.1.0'
    pod 'Image+Bundle+Name', '0.1.0'

    # Team Forked Pods - kept and versioned in private spec Repo
    pod 'MagicalRecord', '2.2.1-pn'
    # ... and so on...
end

这创建了Pods-ProjectName.xcconfig,但它确实创建Pods.xcconfig(因为没有文件属于default广告连播列表)或libPod.a

CocoaPods还从libPods.a构建阶段或Link binary with library从工作区中删除{{>> <{1}}。

这导致链接器错误Pods.xcconfig

为了解决这个问题,我恢复了原始的无目标libPods.a can not be found语句(我的pod目标也需要查看这些广告)并且必须从{{{{}}手动删除ProjectNameTest 1}}从工作区构建阶段和libPods.a

理想情况下,CocoaPods将为您处理此类清理,并且希望将来会出现这种情况(截至本文撰写时,CocoaPods的当前版本为0.29,这需要此手动清理过程)。