12

Issue

I used to have a functional set of Pods in my project (fully working project) until the latest pod install run, now I'm getting "file not found" errors for the headers mentioned in my bridging header (this is a Swift project with Obj-C includes). After doing some research, it seemed like there should be symlinks to the headers in Pods/Headers, that directory is empty for me. However, the pods themselves have been downloaded and all corresponding Pods/[Lib] directories exist.

Last Known Good State

What I've changed right before this error started occurring was specifying :git and :commit flags for one of the libraries I was pulling in. I then reran pod install and started seeing "file not found" errors. At the time I was using Cocoapods 0.39

Current State

I've tried a few solutions from other stack overflow threads, including adding User Header Search Paths, which had no effect (now back to original), and updating my cocoapods. My current version of cocoapods is now 1.0.0.beta.6. Aside from additional headaches I experienced such as having to rewrite parts of my Podfile to be compliant with new standards, I now seem to be back to the same state (with all libraries successfully downloading, but headers failing to be found).

Here is an example of how I'm including my headers in the bridging header:

// In this header, you should import all the public headers of your framework using statements like #import <MyKit/PublicHeader.h>
#import <CocoaLumberjack/CocoaLumberjack.h>

And here is what my Podfile looks like (I've tried to slim it down to avoid irrelevant content):

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

use_frameworks!
pod 'CocoaLumberjack', '2.0.0'
pod 'SwiftyJSON', '~> 2.3'
pod 'Classy', :git => 'https://github.com/ClassyKit/Classy.git', :commit => 'c319908f8bded62e268dfd48ee5d65329b819129'

workspace 'my.work-ios'
project 'mywork' # sdk
project 'Examples/example1' # sample project using sdk
project 'my.work-ios.xcodeproj' # placeholder for main project, not really in use

target 'UnitTests' do
  pod 'Specta'
  pod 'Expecta'
  pod 'OCMock'
  pod 'OHHTTPStubs'
end

# Copy acknowledgements to the Settings.bundle
post_install do | installer |
  require 'fileutils'

  pods_acknowledgements_path = 'Pods/Target Support Files/Pods/Pods-Acknowledgements.plist'
  settings_bundle_path = Dir.glob("**/*Settings.bundle*").first

  if File.file?(pods_acknowledgements_path)
    puts 'Copying acknowledgements to Settings.bundle'
    FileUtils.cp_r(pods_acknowledgements_path, "#{settings_bundle_path}/Acknowledgements.plist", :remove_destination => true)
  end

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['OTHER_SWIFT_FLAGS'] = "-DLEGACY"
    end
  end
end

Update

After some more digging, I discovered that the culprit is use_frameworks! command, omitting it (and in turn removing Swift libraries, because it's required for them) causes Pods/Headers to be populated with Private and Public directories, along with symlinks for the relevant headers.

This was not the case in previous version of cocoapods, and I'm still trying to understand what's happening, because omitting that command is not a usable workaround for me (given the Swift libraries I use in my app).

Update 2

This is already mentioned in the comments, but for convenience I'm putting this here as well. This seems to be caused by a bug reported in this thread: https://github.com/CocoaPods/CocoaPods/issues/4605#issuecomment-208822149. The thread also suggests a few workarounds that may be good enough for some. For me, they were not, so I went back to 0.39.

Alexander Tsepkov
  • 3,946
  • 3
  • 35
  • 59
  • 2
    Can you clarify whether the Podfile above includes `use_frameworks!`? – aednichols Apr 11 '16 at 19:52
  • good catch, looks like when I "slimmed down" my podfile I accidentally omitted `use_frameworks!` command from it as well. The podfile that causes the described issue does indeed contain the command, I have added it to the post. – Alexander Tsepkov Apr 11 '16 at 20:00
  • 1
    I also wanted to mention that I stumbled upon this issue on CocoaPods: https://github.com/CocoaPods/CocoaPods/issues/4605#issuecomment-208822149 and I believe it's the same issue as described here. I was able to get my pods back by reverting back to 0.39 – Alexander Tsepkov Apr 22 '16 at 21:04
  • @AlexanderTsepkov I just ran into the same problem (empty Pods/Headers folder after Cocoapods update and pod update--and can't get rid of use_frameworks! because of Swift libraries). Did you find a solution with the current Cocoapods version? Or are you still using 0.39? – pitachip Jun 21 '16 at 22:29
  • I went back to 0.39. See the CocoaPods issue I linked above, which is still open. Perhaps a suggestion by one of the other members works better for you. – Alexander Tsepkov Jun 22 '16 at 03:35

1 Answers1

0

Have you tried this settings?

target 'TargetProject' do

    pod 'CocoaLumberjack', '2.0.0'
    pod 'SwiftyJSON', '~> 2.3'
    pod 'Classy', :git => 'https://github.com/ClassyKit/Classy.git', :commit     => 'c319908f8bded62e268dfd48ee5d65329b819129'

end

and have this '.swift-version' added? where it contains '3.0-GM-CANDIDATE'

I'm using this kind of settings for swift 3.0

eNeF
  • 3,241
  • 2
  • 18
  • 41