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

当前回答

对我来说,我忘记在Podfile中添加两行代码来目标“Runner”

target 'Runner' do
   use_frameworks!
   use_modular_headers!
end

添加这些代码解决了,希望对你有所帮助!

其他回答

在我的情况下,这是一个错误的早期版本iOS13。

https://forums.developer.apple.com/thread/128435

kambala 2020年3月25日上午12:41 供您参考,这个问题在13.4版本中得到了修复

你必须设置Runpath搜索路径为@executable_path/Frameworks,如下面的Build Settings截图所示:

如果你有任何Swift内置框架,那么你可以将Build Options embedded Content Contains Swift Code设置为YES。

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

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

Xcode 7.2,一台设备上是iOS 9.2,另一台设备上是9.0。两人都犯了错误。不知道是什么改变导致了它,但上面的WWDR解决方案对我来说是正确的。安装证书,问题就解决了。

https://forums.developer.apple.com/message/43547 https://forums.developer.apple.com/message/84846

对于Xcode 12。x,对我有用的是去通用>框架,库和嵌入式内容。然后,选择嵌入和签署所有Agora框架。(默认为不嵌入。