0

(Was "Can't find pod headers only on one computer, works fine on other computers")

I have a project that refuses to build on one of my two machines. It keeps giving me AFNetworking header not found errors, even when building the AFNetworking pod. It started doing this in the middle of my workday a couple weeks ago.

The same project works just fine on my laptop, which I have been relying on since then. A comparison between the two machines doesn’t show any meaningful differences (ruby and pod versions match, same Xcode version, OS).

It still fails even after wiping the pods and DerrivedData out, rebooting the machine, running pod install and trying again. Other copies of the same code exhibit the same issue and trying a different OS user doesn't help.

Other projects based on the same code and cocoa pods process don’t have the same problem. But I need to use this particular project as it is the one we include as many features as possible for testing purposes.

I would really like to get back to using my desktop. What do I do?

Update 1

It seems that the pod install is failing to copy/create links for all of the AFNetworking headers to their correct locations on the broken machine (see below). Strange that I'm not getting an error message. I'm going to see if I can get pods into a verbose mode.

Broken computer

$ ls Pods/AFNetworking/
LICENSE         README.md       UIKit+AFNetworking
AFNetworking/     ARChromeActivity/ AppsFlyer-SDK/    
$ ls Pods/Headers/Private/AFNetworking/
AFAutoPurgingImageCache.h       UIActivityIndicatorView+AFNetworking.h  UIImageView+AFNetworking.h      UIRefreshControl+AFNetworking.h
AFImageDownloader.h         UIButton+AFNetworking.h         UIKit+AFNetworking.h            UIWebView+AFNetworking.h
AFNetworkActivityIndicatorManager.h UIImage+AFNetworking.h          UIProgressView+AFNetworking.h
$ ls Pods/Headers/Public/AFNetworking/
AFAutoPurgingImageCache.h       UIActivityIndicatorView+AFNetworking.h  UIImageView+AFNetworking.h      UIRefreshControl+AFNetworking.h
AFImageDownloader.h         UIButton+AFNetworking.h         UIKit+AFNetworking.h            UIWebView+AFNetworking.h
AFNetworkActivityIndicatorManager.h UIImage+AFNetworking.h          UIProgressView+AFNetworking.h
$ 

Working computer

$ ls Pods/AFNetworking/
AFNetworking        LICENSE         README.md       UIKit+AFNetworking
$ ls Pods/Headers/Private/AFNetworking/
AFAutoPurgingImageCache.h       AFSecurityPolicy.h          UIImage+AFNetworking.h
AFHTTPSessionManager.h          AFURLRequestSerialization.h     UIImageView+AFNetworking.h
AFImageDownloader.h         AFURLResponseSerialization.h        UIKit+AFNetworking.h
AFNetworkActivityIndicatorManager.h AFURLSessionManager.h           UIProgressView+AFNetworking.h
AFNetworkReachabilityManager.h      UIActivityIndicatorView+AFNetworking.h  UIRefreshControl+AFNetworking.h
AFNetworking.h              UIButton+AFNetworking.h         UIWebView+AFNetworking.h
$ ls Pods/Headers/Public/AFNetworking/
AFAutoPurgingImageCache.h       AFSecurityPolicy.h          UIImage+AFNetworking.h
AFHTTPSessionManager.h          AFURLRequestSerialization.h     UIImageView+AFNetworking.h
AFImageDownloader.h         AFURLResponseSerialization.h        UIKit+AFNetworking.h
AFNetworkActivityIndicatorManager.h AFURLSessionManager.h           UIProgressView+AFNetworking.h
AFNetworkReachabilityManager.h      UIActivityIndicatorView+AFNetworking.h  UIRefreshControl+AFNetworking.h
AFNetworking.h              UIButton+AFNetworking.h         UIWebView+AFNetworking.h
$ 

Update 2

There were no errors produced while running pod --verbose install

BergQuester
  • 6,167
  • 27
  • 39

2 Answers2

1

This is related to some to Build setting /cocoapods that cannot find header files:

This may resolve your issue: go xcode : "Build Settings" /"Search Paths"/ "User Header Search Paths"

add:

"${PROJECT_DIR}/Pods" recursive

Here is a link to stackoverflow you will find many alternatives that may fix your issue. CocoaPods cannot find header files

Community
  • 1
  • 1
Idali
  • 1,023
  • 7
  • 10
1

This is a caching issue. Viewing the contents of ~/Library/Caches/CocoaPods show that the AFNetworking pod was missing the headers there as well.

Deleting the CocoaPods cache and my project's pod directory and re-running pod install has fixed the issue.

As to why other projects using the same pod file setup worked? I probably never deleted the Pods directory for those projects.

BergQuester
  • 6,167
  • 27
  • 39