4

I'm running XCode 6.4 and have an app I'm working on. When I run it on simulator with the iPhone/iPad everything works great. If I simulate it on an iphone 4S everything works fine too. As soon as I test it on an iPad Air 2, this error appears on the launch screen.

dyld: Library not loaded: @rpath/AWSAutoScaling.framework/AWSAutoScaling
  Referenced from: /private/var/mobile/Containers/Bundle/Application/B2DA513F-CE10-4B88-B39A-D502F2403537/CoolApp.app/CoolApp
  Reason: no suitable image found.  Did find:
    /private/var/mobile/Containers/Bundle/Application/B2DA513F-CE10-4B88-B39A-D502F2403537/Blah Blah.app/Frameworks/AWSAutoScaling.framework/AWSAutoScaling: mach-o, but wrong architecture

I thought XCode would auto-detect my iPad Air 2's architecture and set it accordingly. I haven't touched any of those settings. I'm also using cocoapods for handling libraries/frameworks. Why is this happening on the iPad Air and how can I fix it?

thank_you
  • 11,001
  • 19
  • 101
  • 185
  • Goto Project > Build Settings (tab) > "Architectures" and "Valid Architectures" What values do you see there? – Adil Soomro Aug 18 '15 at 20:05
  • `arm64 armv7 armv7s` – thank_you Aug 18 '15 at 20:09
  • Looks like your project is looking for a different path. Maybe you can find your solution here http://stackoverflow.com/questions/26024100/dyld-library-not-loaded-rpath-libswiftcore-dylib – Maurice Aug 21 '15 at 10:29
  • Hmm. I'm having trouble getting a solution from the question you provided. I had looked at it before but still to no avail. I'm suprised since AWS is a popular library that no one else came across this either. – thank_you Aug 21 '15 at 18:25
  • What iOS version is used on iPad Air? – Vlad Papko Aug 22 '15 at 00:21
  • It's version `8.4.1`. – thank_you Aug 22 '15 at 04:06
  • It happened to me once, my problem was, i could launch my app on ipad but it was not launching on iphone. i tried various approaches.. one that worked is, go to xcode->preferences->accounts remove and add your developer accounts. the account one which you use for provisioning. download and install fresh certificates. – Prabhu.Somasundaram Aug 26 '15 at 10:01
  • Does the app works if you set BuildSetting->Build Active Architecture ONly -> Debug = NO – N0mi Aug 26 '15 at 10:23
  • @N0mi I'm receiving a plethora of errors (counting up to 43) related to the Apple Mach-O. – thank_you Aug 26 '15 at 15:42
  • what is output of this lipo -info – N0mi Aug 26 '15 at 19:31
  • @N0mi Where can I find that info? – thank_you Aug 26 '15 at 22:40
  • Have you tried doing a clean (cmd+shift+k)? That's usually my first step in debugging this sort of issue. If that doesn't work, maybe delete the derived data directory. – esthepiking Aug 26 '15 at 23:05
  • I've cleaned it and it's still an issue. The derived data directory? Can you further explain? – thank_you Aug 26 '15 at 23:06
  • select Build Phases, expand Link Binary With Libraries , do you see libz.dylib? – N0mi Aug 26 '15 at 23:21
  • Is it possible to share the copy of project, that has lets say just AWS added in it? Are you using the following pods https://cocoapods.org/pods/AWSAutoScaling. – N0mi Aug 26 '15 at 23:23
  • Xcode uses the derived data directory as a cache. It's safe to delete and Xcode will automatically recreate it. It's at ~/Library/Developer/Xcode/DerivedData – esthepiking Aug 26 '15 at 23:32
  • You may also try cleaning the build folder after doing a clean cmd+shift+option+k (note, that option changes it from clean and clean build folder) – esthepiking Aug 26 '15 at 23:39
  • @N0mi, I do not see `libz.dylib` anywhere. Also I'm using CocoaPods and yet I'm using `AWSAutoScaling`. – thank_you Aug 26 '15 at 23:55
  • @esthepiking, Looks like your method worked. Post it as an answer and I'll give credit!!! – thank_you Aug 27 '15 at 00:01
  • @jason328 Excellent! I'm glad that worked! I just posted my procedure in an answer – esthepiking Aug 27 '15 at 14:54

2 Answers2

2

Here's the procedure I follow when having linking issues with a cocoapod:

  1. Clean cmd+shift+k
  2. Clean the build folder cmd+shift+option+k
  3. Remove Xcode's derived data folder ~/Library/Developer/Xcode/DerivedData
  4. Make cocoapods build the pods again by removing the Pods directory in your project, then doing a pod install
esthepiking
  • 1,647
  • 1
  • 16
  • 27
1

When weird situations like these happen to me, and nothing else seems to work, I always turn to the DerivedData folder. XCode keeps data there about all of the apps that you've built and deleting it can't cause any harm (and more often than not, it can solve your issue when all else seems to fail). You can find this folder here: ~/Library/Developer/Xcode/DerivedData.

After you've deleted the contents of that folder, run a clean build and keep your fingers crossed... :-)

Rony Rozen
  • 3,957
  • 4
  • 24
  • 46