Aaron Vegh
Aaron Vegh

Reputation: 5217

iOS 8 Dynamic Framework: Library Not Loaded

I've been working on an iOS 8 app that includes a Share Extension. Both app and extension targets use a new iOS 8-style dynamic framework. In an effort yesterday to get the damned thing into the TestFlight Beta App Review (see here and here), I made a number of changes to my build configuration. The store eventually accepted the app for review, but today as I'm trying to run on my device I'm getting the following error:

dyld: Library not loaded: /Users/aaron/Library/Developer/Xcode/DerivedData/VideoGrabber-gpyzpfvbijsnuyglzzvynckkuwee/Build/Products/Debug-iphoneos/MyAppKitiOS.framework/MyAppKitiOS Referenced from: /private/var/mobile/Containers/Bundle/Application/4C6CFF22-0595-4222-A515-D0D5A1696DBF/MyApp.app/MyApp Reason: image not found

Looking elsewhere for help, I've come across a number of proposed solutions:

Having followed the advice in this otherwise-excellent piece and looking at the solutions offered in the Dev Forums with the exact same issue, I'm totally flummoxed. Anything else I can try?

Upvotes: 11

Views: 5664

Answers (1)

Aaron Vegh
Aaron Vegh

Reputation: 5217

I got it working by comparing something known-good (Apple's Lister app) with my own Build Settings. By comparing the install paths for the framework, and then the search paths for my app target, I was able to get it working. In summary:

  1. In the Framework Target's Dynamic Library Install Name Base, use "@rpath"
  2. In the Framework Target's Dynamic Library Install Name, use "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)" -- this automatically resolves to the name of your framework.
  3. In the Application Target's Runpath Search Paths, use "@executable_path/Frameworks".
  4. Ensure "Always Search User Paths" is set to No. Framework Search Paths could be blank too.
  5. If it's after lunchtime, pour yourself three fingers of scotch. You've earned it.

Since it's morning still, I'll console myself with gentle weeping.

Upvotes: 11

Related Questions