dyld:库未加载:@ rpath / libswiftCore.dylib

本文翻译自:dyld: Library not loaded: @rpath/libswiftCore.dylib

I am trying to run a Swift app on my iPhone 4s. 我正在尝试在iPhone 4s上运行Swift应用程序。 It works fine on the simulator, and my friend can successfully run it on his iPhone 4s. 它在模拟器上运行良好,我的朋友可以在他的iPhone 4s上成功运行它。 I have iOS 8 and the official release of Xcode 6. 我有iOS 8和Xcode 6的正式版本。

I have tried 我试过了

  • Restarting Xcode, iPhone, computer 重新启动Xcode,iPhone,计算机
  • Cleaning & rebuilding 清洁与重建
  • Revoking and creating new certificate/provision profile 吊销和创建新的证书/设置配置文件
  • Runpath Search Paths is $(inherited) @executable_path/Frameworks 运行路径搜索路径为$(inherited) @executable_path/Frameworks
  • Embedded Content Contains Swift Code is 'Yes' 嵌入式内容包含Swift代码为“是”
  • Code Signing Identity is developer 代码签名身份是开发人员

Below is the error in entirety 以下是整体错误

dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /private/var/mobile/Containers/Bundle/Application/LONGSERIALNUMBER/AppName.app/AppName
  Reason: no suitable image found.  Did find:
    /private/var/mobile/Containers/Bundle/Application/LONGSERIALNUMBER/AppName.app/Frameworks/libswiftCore.dylib: mmap() error 1 at
address=0x008A1000, size=0x001A4000 segment=__TEXT in Segment::map() mapping
/private/var/mobile/Containers/Bundle/Application/LONGSERIALNUMBER/APPLICATION_NAME/Frameworks/libswiftCore.dylib

#1楼

参考:https://stackoom.com/question/1lC3Y/dyld-库未加载-rpath-libswiftCore-dylib


#2楼

For the device, you also need to add the dynamic framework to the Embedded binaries section in the General tab of the project. 对于设备,还需要将动态框架添加到项目的“ General选项卡中的“ Embedded binaries部分。
在此处输入图片说明


#3楼

For me none of the previous solutions worked. 对我来说,以前的解决方案都没有用。 We discovered that there is an "Always Embed Swift Standard Libraries" flag in the Build Settings that needs to be set to YES. 我们发现在“构建设置”中有一个“始终嵌入Swift标准库”标志,需要将其设置为“是”。 It was NO by default! 默认情况下是NO!

Build Settings > Always Embed Swift Standard Libraries

After setting this, clean the project before building again. 设置完之后,请在重新构建之前清理项目。

For keen readers some explanation The most important part is: 对于敏锐的读者一些解释最重要的部分是:

set the Embedded Content Contains Swift Code (EMBEDDED_CONTENT_CONTAINS_SWIFT) build setting to YES in your app as shown in Figure 2. This build setting, which specifies whether a target's product has embedded content with Swift code, tells Xcode to embed Swift standard libraries in your app when set to YES. 将您的应用程序中的“嵌入式内容包含Swift代码”(EMBEDDED_CONTENT_CONTAINS_SWIFT)构建设置设置为YES,如图2所示。此构建设置指定目标产品是否具有包含Swift代码的嵌入内容,告诉Xcode将Swift标准库嵌入应用程序设置为YES时。

在此处输入图片说明

The flag was formerly called Embedded Content Contains Swift Code 该标志以前称为Embedded Content Contains Swift Code


#4楼

I think it's a bug when certificates are generated directly from Xcode. 我认为直接从Xcode生成证书时是一个错误。 To resolve (at least in Xcode 6.1 / 6A1052d): 要解决(至少在Xcode 6.1 / 6A1052d中):

  1. go to the Apple Developer website where certificates are managed: https://developer.apple.com/account/ios/certificate/certificateList.action 转到管理证书的Apple Developer网站: https : //developer.apple.com/account/ios/certificate/certificateList.action
  2. select your certificate(s) (which should show "Managed by Xcode" under "Status") and "Revoke" it 选择您的证书(应在“状态”下显示“由Xcode管理”)并“吊销”它
  3. follow instructions here to manually generate a new certificate: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html#//apple_ref/doc/uid/TP40012582-CH31-SW32 请按照此处的说明手动生成新证书: https : //developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html#//apple_ref/doc/uid/TP40012582-CH31- SW32
  4. go to Xcode > Preferences > Accounts > [your Apple ID] > double-click your team name > hit refresh button to update certificates and provisioning profiles 转到Xcode>首选项>帐户> [您的Apple ID]>双击您的团队名称>点击刷新按钮以更新证书和配置文件

#5楼

I started getting this error when I removed: 删除后,我开始出现此错误:

@executable_path/Frameworks

from Runpath Search Paths in my build settings. 从我的构建设置中的运行Runpath Search Paths中。 Replacing it fixed everything up again (thank goodness for source control!) 替换它会再次修复所有问题(感谢您进行源代码控制!)

I don't know how it got there, but it appears to be needed for a binary to find its embedded Swift runtime. 我不知道它是怎么到达那里的,但是似乎二进制文件才需要找到它的嵌入式Swift运行时。


#6楼

In my case, it was just the name of my target : 就我而言,这只是我的目标的名称:

I renamed it like this : MyApp.something and the same issue appeared. 我将其重命名为: MyApp.something ,出现了相同的问题。 But I saw in the build Settings window, my product module name has been changed like this MyApp-something . 但是我在构建设置窗口中看到,我的产品模块名称已经像MyApp-something这样更改 So, I removed the dot in my target name ( MyAppSomething ) and the issue was gone. 因此,我删除了目标名称( MyAppSomething )中的点,问题就消失了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值