Cocoapods: Changing link_with to targets causes file not found

Created on 13 May 2016  路  24Comments  路  Source: CocoaPods/CocoaPods

What did you do?

Changed "link_with['A', 'B']" to "target 'A' do X end" and "target 'B' do X end" and put the pod lines to "def X" block. Run pod update.

What did you expected to happen?

The project would compile without errors.

What happened instead?

RSKImageCropper.h
'RSKImageCropper/CGGeometry+RSKImageCropper.h' file not found

The dependency is:
pod 'RSKImageCropper'

CocoaPods Environment

Stack

   CocoaPods : 1.0.0
        Ruby : ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
    RubyGems : 2.4.6
        Host : Mac OS X 10.11.4 (15E65)
       Xcode : 7.3 (7D175)
         Git : git version 2.6.4 (Apple Git-63)
Ruby lib dir : /Users/tapani/.rvm/rubies/ruby-2.2.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ b57a5113bdba0b36c1e44b9ae94f1bd7368a71f0

Installation Source

Executable Path: /Users/tapani/.rvm/gems/ruby-2.2.1/bin/pod

Plugins

cocoapods-deintegrate : 1.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.0.0

Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

def X
    pod 'RSKImageCropper'
    pod 'Fabric'
    pod 'Crashlytics'

    project '../MyProject.xcodeproj'
end

target 'MyApp' do
    X
end

target 'MyAppTests' do
    X
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

Project that demonstrates the issue

awaiting input

Most helpful comment

Deleted the DerivedData folder and the issue is gone. Another error appeared and had to also delete the Pods directory before the build process was successful.

All 24 comments

Have you tried

target 'MyApp' do
    pod 'RSKImageCropper'
    pod 'Fabric'
    pod 'Crashlytics'
    project '../MyProject.xcodeproj'

  target 'MyAppTests' do
      inherit! :search_paths
  end
end

as recommended i the migration guide?

Just tried that and it did not help. The issue is not with the MyAppTests target. I get the error message when trying to compile the MyApp target.

Ah, then this might be the same as https://github.com/CocoaPods/CocoaPods/issues/5307#issuecomment-219043493 - thanks @tapz

@tapz, could you try this syntax:

#import <RSKImageCropper/CGGeometry+RSKImageCropper.h>

or:

#import <CGGeometry+RSKImageCropper.h>

RSKImageCropper is not my project, but a dependency. I cannot change the import there.

Changing the import to this helps:

import "CGGeometry+RSKImageCropper.h"

RSK is not the only dependency, which gives the error. I cannot change imports in Facebook SDK!

Are you using pod 'FBSDKCoreKit'? If yes, are you importing with the following syntax?

#import <FBSDKCoreKit/FBSDKCoreKit.h>

@tapz as requested in the issue template, please share a project that reproduces the issue -- otherwise there's no way for people to debug. Thanks!

@Coeur I import it only to my Swift files like this:

import FBSDKCoreKit

@segiddins I can't share the project as it's our company's application. But I can try to make a new project with the same dependencies. I assume the same issue happens with the same podfile in any project so you could reproduce it just by using the podfile.

@tapz if you can't share your original project, please create a new project that reproduces the issue

Tested with a new project, but cannot reproduce. No idea what's wrong with the original project.

If you can't reproduce it elsewhere, you may try to delete the ~/Library/Developer/Xcode/DerivedData folder.

Deleted the DerivedData folder and the issue is gone. Another error appeared and had to also delete the Pods directory before the build process was successful.

Aww, that's a shame

Does not work with the tests target. Works in the example projects though...

Are you inheriting search paths from the app target in your test target?

...
target 'MyTests' do
    inherit! :search_paths
end

end

Weird. In that case, please provide an example project that demonstrates the issue so we can try and look into it. Thanks!

That's the problem. It does not occur in the example project.

I am having the same problem, and I've reproduced it in a trivial sample application. I created a new application, copied the Podfile, added a bridging header, and added one of the problematic dependencies to the bridging header.

I have cleaned the project, deleted DerivedData (with XCode closed), reinstalled the pods, uninstalled the pods, deleted the Pods/ directory, and anything else I could think of. I have done some of those things to the sample project as well, with the same result.

The pods install fine, but the app fails to build, saying some of the Pod header files are not found.

pod _0.39.0_ install works as expected on the identical setup, installing the pods and compiling (both in the actual app and the sample).

I previously had the Podfile of the main project in the abstract_target format, and it had the same problem. My main project also has other targets, including tests, but the issue is the same.


Stack

   CocoaPods : 1.0.0
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
    RubyGems : 2.0.14.1
        Host : Mac OS X 10.11.4 (15E65)
       Xcode : 7.3 (7D175)
         Git : git version 2.6.4 (Apple Git-63)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : DSTV-Cocoapods - https://bitbucket.org/iosappsteam/dstv-cocoapods @ 0b0b345abaaeb2653024cc346875a23c99c7625a
               master - https://github.com/CocoaPods/Specs.git @ fac08829c01d1d0842aeeb12f5a5f86b0fda26d3

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.0.0

Podfile

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'
use_frameworks!

def core_pods
    pod 'DACircularProgress', '2.2.0'
    pod 'SDWebImage', '3.7.1'
    pod 'REFrostedViewController', '~> 2.4.7'
    pod 'FXBlurView'
    pod 'MBProgressHUD'
    pod 'MarqueeLabel'
    pod 'Parse'
    pod 'Crashlytics'
end

target 'CocoaPodsIssueTest' do
    core_pods
end

# Make all dependencies build for all architectures 
post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
    end
end

@danielcarr I got a 404 on your link. You should make the repo public.
[edit: oh well, I guess you put it on github instead of bitbucket: https://github.com/danielcarr/cocoapods-sample]

@Coeur My apologies, I changed my mind and forgot to change the link accordingly. I've corrected it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

k06a picture k06a  路  3Comments

iosdev-republicofapps picture iosdev-republicofapps  路  3Comments

steffendsommer picture steffendsommer  路  3Comments

Curtis-Halbrook picture Curtis-Halbrook  路  3Comments

pronebird picture pronebird  路  3Comments