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条回答
2楼-- · 2020-02-16 07:52

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.

查看更多
别忘想泡老子
3楼-- · 2020-02-16 08:02

For me it was because of the SSL issue, I had set my developer, distribution certificates on my Mac(Keychain) to 'Always Trust' for one of my other project. I had to change them back to 'Use System Defaults'. it was working for me then!!

查看更多
可以哭但决不认输i
4楼-- · 2020-02-16 08:04

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

查看更多
Summer. ? 凉城
5楼-- · 2020-02-16 08:04

Made the library which shows not loaded changed from required to optional in Linked binaries and frameworks. It is working perfectly now

查看更多
虎瘦雄心在
6楼-- · 2020-02-16 08:04

I installed third party libraries using Cocoapods. Got the same error, tried everything but finally realised I havent had use_frameworks! in my pod file.

So removed the currently installed library, added use_frameworks! line in pod file, reinstalled the libraries and all worked for me.

查看更多
\"骚年 ilove
7楼-- · 2020-02-16 08:05

When non of those solution works:

  1. (Optional) Get a clear knowledge from here on different search path type
  2. Make sure that your .framework file paths are added in Build Settings -> Framework Search Paths. You can keep all framework files somewhere in App/libs/ and add this folder and enable recursively.
  3. Make sure that your .a files paths are added in Build Settings -> Library Search Paths.

enter image description here

查看更多
登录 后发表回答