ios dyld:库未加载:@rpath 与 iOS8

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28244468/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 04:36:45  来源:igfitidea点击:

dyld: Library not loaded: @rpath with iOS8

iosframeworksios8xcode6

提问by ArdenDev

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

我正在使用 Xcode6 和 iOS8 创建一个 iOS 框架。当我将此与 iOS 应用程序链接并尝试在设备上运行它时,我收到此错误

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.

我找不到任何与此相关的文档。这是 Xcode6 引入的新功能,我希望它可以通过简单地将框架包含到任何需要它的应用程序中来工作。

回答by ArdenDev

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.

  1. 在框架项目设置中,将安装目录从“/Library/Frameworks”更改为“@executable_path/../Frameworks”

  2. 在包含此框架的项目中,添加复制文件阶段并将此框架复制到“Frameworks”文件夹。执行此操作后,请确保此框架列在“嵌入式​​二进制文件”部分下。

回答by Tom Howard

Issue resolved using this answer. According to @vladof81:

使用此答案解决了问题。根据@vladof81:

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

在目标的 General 选项卡中,有一个 Embedded Binaries 字段。当您在那里添加框架时,崩溃就解决了。

Reference is hereon Apple Developer Forums.

参考是这里的苹果开发者论坛。

回答by Venu Gopal Tewari

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

如果不只是在项目目录的“框架”部分添加该框架后在“嵌入框架”中添加该框架。
在此处输入图片说明

回答by Stunner

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.

我在通过 CocoaPods 安装的库上收到此错误。清理构建文件夹 ( cmd + option + shift + k) 然后进行清理 ( cmd + shift + k) 最终为我解决了这个问题。

回答by Ronaldo Albertini

If you are using Carthage

如果您使用的是迦太基

Run carthage updateon terminal

carthage update在终端上运行

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

转到项目设置 -> 构建阶段 -> 迦太基复制框架

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

输入文件中添加行: $(SRCROOT)/Carthage/Build/iOS/YOURLIBRARY.framework

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

将此行添加到输出文件:$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/YOURLIBRARY.framework

回答by Eslam Eslam Nour

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

dyld:库未加载:@rpath/FrameworkName.framework/FrameworkName 引用自:/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
  1. 从常规选项卡

Frameworks, Libraries, and Embedded Content

框架、库和嵌入内容

  • add the framework and make sure to make it Embed & Sign
  • 添加框架并确保将其嵌入并签名

General Tab

常规选项卡

  1. From Build Phases
  1. 从构建阶段

Dependences

依赖

  • add the framework to it
  • 添加框架

Build Phases

构建阶段

回答by Gee Kay

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!!

对我来说,这是因为 SSL 问题,我已将我的 Mac(钥匙串)上的开发人员分发证书设置为我的其他项目之一的“始终信任”。我不得不将它们改回“使用系统默认值”。它当时对我有用!!

回答by Saranjith

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

在链接的二进制文件和框架中,将显示未加载的库从必需更改为可选。它现在工作得很好

回答by prodeveloper

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

除了上述解决方案外,重新检查您的应用程序中包含的框架的路径

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

构建设置 --> 搜索路径 --> 框架搜索路径

回答by Aks

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

dyld:库未加载:@rpath/FrameworkName.framework/FrameworkName 引用自:/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.

1.请从设备上删除您的应用程序,清理构建并重新构建并在设备上运行。

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.

2.如果以上步骤对您没有帮助,请检查以下设置:
从“TARGET”>“Build Settings”>“Runpath Search Paths”然后检查值“$(inherited)”和“@executable_path/Frameworks” , 如果它们不存在,请随意添加。

Build your app and run it on device

构建您的应用程序并在设备上运行它