dyld: Library not loaded: @rpath with iOS8

2020-02-16 07:30发布

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.

12条回答
\"骚年 ilove
2楼-- · 2020-02-16 07:40

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

查看更多
虎瘦雄心在
3楼-- · 2020-02-16 07:41

In addition to the above solutions, recheck the paths of frameworks included in your application under

Build Settings --> Search Paths --> Framework Search Paths

查看更多
别忘想泡老子
4楼-- · 2020-02-16 07:42

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.

查看更多
Emotional °昔
5楼-- · 2020-02-16 07:45

I was getting this error on a library installed through CocoaPods. Cleaning the build folder (cmd + option + shift + k) and then doing a clean (cmd + shift + k) was what ended up resolving this issue for me.

查看更多
Root(大扎)
6楼-- · 2020-02-16 07:49

If you are using Carthage

Run carthage update on terminal

Go to Project Settings -> Build Phases -> Carthage Copy Frameworks

Add line in Inputs files: $(SRCROOT)/Carthage/Build/iOS/YOURLIBRARY.framework

Add this line to Output files: $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/YOURLIBRARY.framework

查看更多
老娘就宠你
7楼-- · 2020-02-16 07:50

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.Please delete your app from device, Clean the build and and rebuild and run on the device.

2.If above steps does not help you, then please check for below settings :
From "TARGET">"Build Settings">"Runpath Search Paths" & then check for values "$(inherited)" & "@executable_path/Frameworks", Feel free to add incase they don't exist.

Build your app and run it on device

查看更多
登录 后发表回答