1
votes

When we build our app for ad hoc deployment and run it, the app crashes right away and I see the following in the crash logs:

**Dyld Error Message:**
  **Library not loaded: @rpath/libswiftAssetsLibrary.dylib**
  Referenced from: /private/var/mobile/Containers/Bundle/Application/73FD1DE2-820C-443C-B7CA-B79DB9CF3466/MyApp.app/MyApp
  Reason: no suitable image found.  Did find:
    /private/var/mobile/Containers/Bundle/Application/73FD1DE2-820C-443C-B7CA-B79DB9CF3466/MyApp.app/Frameworks/libswiftAssetsLibrary.dylib: mmap() error 1 at address=0x0052F000, size=0x00004000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/73FD1DE2-820C-443C-B7CA-B79DB9CF3466/MyApp.app/Frameworks/libswiftAssetsLibrary.dylib
    /private/var/mobile/Containers/Bundle/Application/73FD1DE2-820C-443C-B7CA-B79DB9CF3466/MyApp.app/Frameworks/libswiftAssetsLibrary.dylib: mmap() error 1 at address=0x0053A000, size=0x00004000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/73FD1DE2-820C-443C-B7CA-B79DB9CF3466/MyApp.app/Frameworks/libswiftAssetsLibrary.dylib
  Dyld Version: 353.10

As per suggestions from different questions on SO, we've tried the following without luck:

  1. Revoke and regenrate certs
  2. Make sure the new cert has OU set
  3. Make sure the runpath has @executable_path/Frameworks
  4. Make sure embedded content contains swift code is set to yes.

We're still running into this issue. Any help/pointers will be greatly appreciated.

1
Have you tried to restart XCode? Do you have this problem with Debug test in iOS device?Duyen-Hoa
@HoaParis Yes I've restarted XCode and same problem exists. Yes I ran it on test device and I get the same error. It only runs fine in simluator.singhspk
Maybe you called @import AssetsLibrary in your code? If this is the case, verify that you have imported AssetsLibrary framework (and eventually remove that @import).Duyen-Hoa
Yes we call @ import AssetsLibrary in our code. Removing @import doesn't help.singhspk
Just for info: it's recommended to use Photos framework for iOS >= 8.0 developer.apple.com/library/ios/documentation/AssetsLibrary/…Duyen-Hoa

1 Answers

1
votes

I resolved the same issue by removing the derived data folder. Steps: XCode->Preference->Locations->Derived data->Advanced Find the folder and remove it. After that rebuild and it works.