Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom framework not loaded dyld: Library not loaded: @rpath/Custom.framework/

I have an app with several custom dynamic frameworks which means I am using iOS 8 as the SDK on Xcode 6.2. My Mac is on Yosemite. The frameworks have Swift sources and resources.

The app is distributed enterprise so I just create an IPA and distribute internally via a webpage where the user can download and install the app.

The app installs and runs on iPhone 5(iOS 8.1.2), iPod Touch(iOS 8.2) and simulators BUT NOT on iPhone 6(iOS 8.1.2). The error is always dyld: Library not loaded: @rpath/Custom.framework/. Whenever I remove and add the frameworks back to try to fix it another framework pops up as not loaded on the iPhone 6. (Why!!!)

The following were set:

  • @executable_path/Frameworks
  • Embedded Content Contains Swift code - Yes
  • Frameworks in embedded binaries
  • Embedded Frameworks
  • Link Binary With Libraries

What is causing these issues and what can I do to make sure that the app runs consistently on all devices and iOS 8 versions.

Most of the solutions I find are trial and error suggestions.

like image 354
naz Avatar asked Mar 30 '15 15:03

naz


1 Answers

I didn't stop figuring out the cause of the issue until I read about architectures. So it prompted me to build the frameworks while an iPhone 6 is connected. I created a project with all the defaults. Added a couple of frameworks including Alamofire. Built them while iPhone 6 connected. Generated an archive and deployed and installed OTA. When the app was installed it ran without issues.

I tried to confirm it by building against my iPod(MD717ZP/A). I'm not sure if this was 5th Gen. First I emptied the derived data folder, Cleaned all projects including the frameworks. Built and deployed the app. Installed it on the iPod it was running. I installed it on the iPhone 6 and it crashed instantly.

I tried the same process over and over again. Built against iPhone 6 then iPod then installed on both. The results just confirmed that I need to have it built on iPhone 6 so the app would run on that device and lower.

Remember I ONLY did add the frameworks to "Embedded Binaries" (Target > General > Embedded Binaries) then built on iPhone 6 to make it work. This could mean you need to have the latest device if you want it running on all devices due to some architecture requirements.

Update: In addition to the knowledge above you may want to check the "Build Active Architecture Only" section in the Build Settings tab. It means it will build based on the connected hardware if set to YES else it will build for the architectures you support like Valid Architectures.

like image 194
naz Avatar answered Sep 28 '22 04:09

naz