我正在试着在我的iPhone 4s上运行Swift应用程序。它在模拟器上运行良好,我的朋友也可以在他的iPhone 4s上成功运行。我有iOS 8和官方发布的Xcode 6。

我试过了

重启Xcode, iPhone,电脑 清洁和重建 撤销并创建新的证书/供应配置文件 运行路径搜索路径是$(inherited) @executable_path/Frameworks 包含Swift代码的嵌入内容是“是” 代码签名身份是开发人员

下面是完整的错误

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

当前回答

我认为直接从Xcode生成证书是一个错误。要解析(至少在Xcode 6.1 / 6A1052d中):

go to the Apple Developer website where certificates are managed: https://developer.apple.com/account/ios/certificate/certificateList.action select your certificate(s) (which should show "Managed by Xcode" under "Status") and "Revoke" it 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 go to Xcode > Preferences > Accounts > [your Apple ID] > double-click your team name > hit refresh button to update certificates and provisioning profiles

其他回答

假设项目P正在导入自定义库L,那么必须将L添加进去

P ->构建阶段->嵌入框架-> +。这对我很有用。

以上的解决方案对我不起作用。 我通过以下步骤解决这个问题:

我不得不去电话(设置>配置文件)并删除 手机中的配置文件(包括所有相关的应用程序) 与这些概况/条款)。 在那之后,确保你 在xcode中下载苹果的条款。进入xcode设置> 帐户和登录到你的苹果开发者帐户。

我在试图在一个私人pod上运行单元测试时遇到了这个问题。

每个人建议的我都做了。毫无效果。

我所要做的就是在不同的模拟器上运行单元测试。

我没有尝试重置模拟器的内容和设置,也许这也可以¯_()_/¯

我测试了上面所有的解决方案,但没有一个解决问题。 我使用的是Xcode 10.2和macOS 10.14.3。 首先,我安装了swift 5对命令行工具的运行时支持,但没有任何变化 第二,我将操作系统更新到10.14.4,没有任何变化 第三,我把Xcode更新到11.2.1,问题解决了(不使用Xcode 11.2。它有存档问题,已弃用)

我在Xcode 13+上创建版本时也遇到了同样的问题。不得不把时间浪费在解决这个问题上。最后,我能够解决以下步骤的问题。

我在构建设置中的运行路径搜索路径中添加了一个新的发布条目->链接。

/usr/lib/swift

添加了这个功能后,我可以运行我的应用程序而不会崩溃!