5

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.

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389

5 Answers5

5

Maybe try solution from: 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
S. Matsepura
  • 1,673
  • 1
  • 17
  • 24
1

From iOS - Build fails with CocoaPods cannot find header files :

Make sure your Podfile includes link_with on targets missing a config file. Cocoapods only sets the first target by default otherwise. e.g.

platform :osx, '10.7'
pod 'JSONKit',       '~> 1.4'

link_with 'Pomo', 'Pomo Dev', 'Pomo Tests'
mikep
  • 3,841
  • 8
  • 21
0

Restarting Xcode fixed it for me

nefarianblack
  • 802
  • 8
  • 16
0

The following steps worked in my case:

  1. Quit the Xcode n Simulator
  2. Delete Drived data
  3. Again open your project
  4. Clear it
bestiosdeveloper
  • 2,339
  • 1
  • 11
  • 28
0

I have also encountered a similar issue.

I struggled with it for two days but was able to solve it unexpectedly. I selected the framework target that depends on a Pod, went to "Build Settings" > "Packaging" > "Defines Module" and set it to "No". Then I rebuilt the target and the error disappeared. I'm not sure about the exact reason why this worked, but it did solve the problem for me. I hope this information helps you. If you have a more in-depth understanding of this issue, please feel free to share your insights.

yancaico
  • 1,145
  • 11
  • 21