dyld: Library not loaded: @rpath with iOS8

I'm creating an iOS framework with Xcode6 and iOS8. When I link this with an iOS app and try running it on the device I get this error

dyld: Library not loaded: @rpath/FrameworkName.framework/FrameworkName
  Referenced from: /private/var/mobile/Containers/Bundle/Application/0F2C2461-A68B-4ABA-A604-B88E6E9D1BB1/AppName.app/AppName
  Reason: image not found

The 'Runpath Search Paths' build setting for the framework is set by default to

'@executable_path/Frameworks', '@loader_path/Frameworks'

I could not find any documentation related to this. This was something new introduced with Xcode6 and I would expect it to just work by simply including the framework into any app that needs it.


To make this work

  1. In the framework project settings change the install directory from '/Library/Frameworks' to '@executable_path/../Frameworks'

  2. In the project that includes this framework, add a copy files phase and copy this framework to the 'Frameworks' folder. Once you do this ensure that this framework is listed under the 'Embedded Binaries' section.


Issue resolved using this answer. According to @vladof81:

In the target's General tab, there is an Embedded Binaries field. When you add the framework there the crash is resolved.

Reference is here on Apple Developer Forums.


I also had same kind of problem where I was not able to launch the app & app was crashing with above message :

dyld: Library not loaded: @rpath/FrameworkName.framework/FrameworkName Referenced from: /private/var/mobile/Containers/Bundle/Application/xxxxxxxxxxxxxxxxxxx

Reason: image not found

Here is my approach that helped me to resolve this error:

  1. From General Tab

Frameworks, Libraries, and Embedded Content

  • add the framework and make sure to make it Embed & Sign

General Tab

  1. From Build Phases

Dependences

  • add the framework to it

Build Phases


Check if you can find framework in context under :

Build Phases > Embed Frameworks >

If not just add that framework in "Embed Frameworks" after adding that framework in your project directory's "Frameworks" section.
enter image description here