我正在试着在我的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

当前回答

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

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

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

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

其他回答

这些解决方案似乎都不起作用,但当我将全球开发人员证书的权限更改为使用系统默认值时,它就起作用了。我在下面的链接中包含了步骤和截图

我鼓励你在苹果漏洞报告中登录,因为苹果真的应该解决这个巨大的错误: https://stackoverflow.com/a/41401354/559760

我认为直接从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

我在运行Swift测试时遇到了这个问题(但不是我的应用程序)。事实证明,测试需要在测试目标的Runpath Search Paths构建设置中有更多的@executable_path/Frameworks。以下设置Runpath搜索路径对我来说很有魅力:

$(inherited)
@executable_path/Frameworks
@loader_path/Frameworks

对于我来说,构建一个依赖于第三方Swift库(例如SQLite)的MacOS命令行Swift应用程序,上面的解决方案似乎都不起作用。有效的方法是直接将以下路径添加到构建设置中的Runpath搜索路径中:

/应用程序/ xcode /内容/ /开发/工具链/ XcodeDefault.xctoolchain / usr / lib /快速/ macosx /

这样做确实会在运行时给出一个警告,说Xcode已经找到了两个版本的libswiftCore——这是有道理的。除了没有包含这一行导致Xcode找不到任何版本的libswiftCore。

无论如何,这将为我做,即使它似乎不正确-我的应用程序只是一个实用工具,我不打算分发,至少它现在运行!

更改目标的Copy Pods资源:

"${SRCROOT}/Pods/Target Support Files/Pods-Wishlist/Pods-Wishlist-resources.sh"

to:

"${SRCROOT}/Pods/Target Support Files/Pods-Wishlist/Pods-Wishlist-frameworks.sh"