菜鸟教程小白 发表于 2022-12-12 19:04:02

ios - 集成 Realm Swift 后 libswiftCore.dylib 的库版本不兼容


                                            <p><p>安装 Realm Swift 后,我​​在 Xcode 中运行我的测试程序时看到以下错误:</p>

<blockquote>
<p>dyld: Library not loaded: @rpath/libswiftCore.dylib<br/>
 Referenced from: /Users/(*****)/Library/Developer/CoreSimulator/Devices/*****/data/Containers/Bundle/Application/*****/My.app/Frameworks/RealmSwift.framework/RealmSwift<br/>
 Reason: Incompatible library version: RealmSwift requires version 1.0.0 or later, but libswiftCore.dylib provides version 0.0.0</p>
</blockquote>

<p>我试过了:</p>

<ul>
<li>清理构建文件夹</li>
<li>重启 Xcode</li>
<li>启用 <em>Embedded Content Contains Swift Code</em> build设置。</li>
</ul>

<p>我正在使用 Xcode 7.2.1 和 Swift 2.1.1,并且正在使用其动态框架集成 Realm。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>Apple 声明您不能混合和匹配使用不同版本的 Swift 构建的二进制文件:<a href="https://developer.apple.com/swift/blog/?id=2" rel="noreferrer noopener nofollow">https://developer.apple.com/swift/blog/?id=2</a> </p>

<p>所以你有两个选择:</p>

<ol>
<li>按照 <a href="https://realm.io/docs/swift/latest/#installation" rel="noreferrer noopener nofollow">https://realm.io/docs/swift/latest/#installation</a> 中的说明从源代码构建 Realm Swift </li>
<li>使用与您的项目使用相同版本的 Swift 构建的 Realm Swift 的预构建版本。 0.98.5 是使用 Swift 2.1.1 构建的最后一个版本:<a href="https://github.com/realm/realm-cocoa/releases/tag/v0.98.5" rel="noreferrer noopener nofollow">https://github.com/realm/realm-cocoa/releases/tag/v0.98.5</a> . 0.98.6 及更高版本是使用 Swift 2.2 构建的。</li>
</ol></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 集成 Realm Swift 后 libswiftCore.dylib 的库版本不兼容,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/36250019/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/36250019/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 集成 Realm Swift 后 libswiftCore.dylib 的库版本不兼容