1

I'm using Cocoapods with my Xcode project, but it seems to be causing both "library not found" and header "file not found" errors when building with the Simulator but not when I have a device connected nor when using "Generic iOS Device".

My Podfile is simple. I have only one pod in there, for Microsoft's ADAL SDK, needed for single sign-on. When I use use_frameworks! in the Podfile I get:

fatal error: 'ADAL/ADAL.h' file not found

for the line

#import <ADAL/ADAL.h>

but if I use use_modular_headers! instead of use_frameworks! I get:

ld: warning: directory not found for option '-L/Users/memyself/Documents/iOS_Projects/ASSIST-main/ASSIST-main/DerivedData/MyApp/Build/Products/Debug-iphonesimulator/ADAL'
ld: library not found for -lADAL

Even if I disable both of those it builds fine for the device and for "Generic iOS Device", but fails with 'ADAL/ADAL.h' file not found error.

Yes, there are plenty of SO questions and answers for those kinds of errors (such as here) but no success trying them. To be specific, I'm using $(inherited) in the recommended search paths, setting enable bitcode to NO, making sure I'm opening the xcworkspace not the xcodeproj file, and have tried

$ pod deintegrate
$ pod clean
$ rm Podfile

Also, my app uses AWS and Firebase and I was getting the same problem with them, but was able to fix them by manually adding the necessary frameworks. However, I don't have a framework for ADAL, and frankly I need to fix this so I can use Cocoapods to install and manage my AWS and Firebase dependencies. It is very suspicious that it only fails when building for the Simulator, what project settings could cause this?

Alyoshak
  • 2,696
  • 10
  • 43
  • 70
  • That's weird mate, I just try `pod 'ADAL', '~> 4.0'` and it builds success in both device and simulator. Did you try to delete your `DerivedData ` folder? – batphonghan Mar 19 '19 at 14:16
  • Yes. One of the first things I tried. I've even changed its location in Preferences->Locations from 'default' to 'relative', to force a clean slate. – Alyoshak Mar 19 '19 at 14:42
  • which's the version of cocoapod you using btw. Could you try to update it? – batphonghan Mar 19 '19 at 15:12
  • I am using the latest version, 1.6.0. Actually, I found a solution, but don't know why it fixes things. In my Podfile I had: platform :ios, '9.0' and in my project I had a deployment target of 9.0. But when I changed both to 11.0 the problem went away. – Alyoshak Mar 19 '19 at 20:16

2 Answers2

4

Update the deployment target and the Podfile 'platform' target. Update both from 9.0 to 11.0. Change this line in your Podfile

platform :ios, '11.0' and this in both your Target and Project:

enter image description here

Paresh Masani
  • 7,474
  • 12
  • 73
  • 139
  • I had been able to build fine, but began having intermittent trouble when I updated cocoapods, and then when had to download a new working copy for my project I really got stuck. It was finding the header file when I was targeting 9.0. Just fyi. Also, I was able to build a debug version for my device. Device doesn't automatically build a release version (I don't think). – Alyoshak Mar 22 '19 at 14:51
2

Try changing build active architecture only in build settings.
enter image description here

Heisenbug
  • 951
  • 6
  • 25