Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Add the framework to the App Target's Embedded Binaries section of the General tab. Done.

  • Enter "@executable_path/Frameworks" into the Runpath Search Paths section of Build Settings on the App Target. Done.

  • Ensure there's an entry in the "Copy Files" build phase. Step one actually does this for you, so... Done.

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?

like image 647
Aaron Vegh Avatar asked Nov 27 '14 15:11

Aaron Vegh


1 Answers

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.

like image 62
Aaron Vegh Avatar answered Nov 09 '22 13:11

Aaron Vegh