Custom framework not loaded dyld: Library not loaded: @rpath/Custom.framework/
Asked Answered
S

3

5

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.

Soso answered 30/3, 2015 at 15:18 Comment(0)
S
8

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.

Soso answered 31/3, 2015 at 7:4 Comment(2)
A thousand up votes bro, if I can. This is the answer, "Remember I ONLY did add the frameworks to "Embedded Binaries" (Target > General > Embedded Binaries)"Mood
Thx, saved me tons of timeAngilaangina
M
0

Check the Linking section in the Build Settings tab, following item may not been set:

Runpath Search Paths = @executable_path/Frameworks
  • This fixed an error for me:

    dyld: library not loaded: @rpath/CorePlot.framework/CorePlot
    reason: image not found
    
Marguerita answered 23/2, 2017 at 16:18 Comment(0)
E
0

I had same issue with xcode 10 with Mojave & I am using Cocoa pods, here are my solution :

  1. Make sure your target->build settings->iOS Deployment Target is set to the latest IOS.
  2. In Pod file, remove "inherit! :search_paths" for the test UI target. For Eg.
Existing pod file :

    target 'MyApp' do
        pod 'oAuthorize'
        target 'MyUITest1' do
            inherit! :search_paths
        end
        target 'MyFunctionalTest' do
            inherit! :search_paths
        end
    end
    Remove "inherit! :search_paths" for all sub-targets. 

    target 'MyApplication' do
        pod 'oAuthorize'
        target 'MyUITest1' do
        end
        target 'MyFunctionalTest' do
        end
    end
Endopeptidase answered 6/11, 2018 at 5:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.