Including a pod inside a framework target: file not found

时间:2017-06-12 17:10:30

标签: ios xcode cocoapods xcode8 ios-frameworks

I'm using framework targets (for better code reuse and IB_Designables), and I've already had a framework target working perfectly. I've decided to move some other classes to a framework target too.

I've set up the pods (just a single one in this case), but whenever I try to include the pod I'm getting not found error.

enter image description here

No change if I try to use the modules approach too:

enter image description here

The problem is that I've already got another framework too, with the same settings (cross checked all the compiler settings/linker flags/build phases etc) and that framework has no issue importing its pods.

Here is my podfile (TUComponents is the working on, TUModels is the failing one):

[...]
target 'TUComponents' do


    pod 'AHKNavigationController'
    pod 'TTTAttributedLabel'

    use_frameworks!


end

target 'TUModels' do


    pod 'JSONModel'

    use_frameworks!


end

Even weirder; Xcode has no problem code-completing importing the JSONModel/JSONModel.h header (or JSONModel in case of module @import). But when I try to compile, it fails.

What might be wrong with my configuration?

UPDATE: If I give up using frameworks in pods and use regular old static library, and set allow non-modular includes in frameworks to YES, I can build. But I have no idea why I can't build when using Pod frameworks.

4 个答案:

答案 0 :(得分:2)

也许尝试解决方案:https://www.natashatherobot.com/cocoapods-installing-same-pod-multiple-targets/

platform :ios, '9.0'

use_frameworks!

# My other pods

def testing_pods
    pod 'JSONModel'
end

target 'TUComponents' do
    pod 'AHKNavigationController'
    pod 'TTTAttributedLabel'
    testing_pods
end

target 'TUModels' do
    testing_pods
end

答案 1 :(得分:0)

重新启动Xcode为我修复了

答案 2 :(得分:0)

来自source file (line 77)

  

确保您的Podfile在缺少配置文件的目标上包含link_with。 Cocoapods默认只设置第一个目标。 e.g。

Amazon Cognito

答案 3 :(得分:0)

以下步骤适用于我的情况:

  1. 退出Xcode n Simulator
  2. 删除驱动数据
  3. 再次打开您的项目
  4. 清除