我正在试着在我的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 13这里(13.1 react-native)。

创建一个干净的react-native项目,并将/usr/lib/swift作为Runpath Search Paths的一个条目。

在添加了这些之后,我的项目最终没有崩溃!

以前的建议无济于事。

其他回答

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

target 'Runner' do
   use_frameworks!
   use_modular_headers!
end

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

要添加到企业分发证书解决方案:您可以打开Keychain并检查证书,如果有任何红色文本表示信任链无法验证或正在撤销,那么它将不起作用!在我的电脑上,我们的分发证书显示为已撤销,尽管门户网站显示它仍然有效。我们获得了一个新的分发证书,在Keychain中是绿色的(有效的),这解决了这个问题。

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

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

我也有同样的问题

有很多答案,但我的答案可能会帮助别人。

// MARK: -核心数据堆栈

 lazy var persistentContainer: NSPersistentContainer = {
            /*
             The persistent container for the application. This implementation
             creates and returns a container, having loaded the store for the
             application to it. This property is optional since there are legitimate
             error conditions that could cause the creation of the store to fail.
            */
            let mom = NSManagedObjectModel.mergedModel(from: [Bundle(for: Self.self)])!
            
            let container = NSPersistentContainer(name: "Test", managedObjectModel: mom)
            container.loadPersistentStores(completionHandler: { (storeDescription, error) in
                if let error = error as NSError? {
                    // Replace this implementation with code to handle the error appropriately.
                    // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
                     
                    /*
                     Typical reasons for an error here include:
                     * The parent directory does not exist, cannot be created, or disallows writing.
                     * The persistent store is not accessible, due to permissions or data protection when the device is locked.
                     * The device is out of space.
                     * The store could not be migrated to the current model version.
                     Check the error message to determine what the actual problem was.
                     */
                    fatalError("Unresolved error \(error), \(error.userInfo)")
                }
            })
            return container
        }()

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