菜鸟教程小白 发表于 2022-12-12 10:46:42

ios - 如何同时连接 Realm 与 watchOS 和 iOS 应用程序?


                                            <p><p>所以,Realm 网站上有简单的说明:</p>

<blockquote>
<p>Installation (Swift 2.1.1):
...
2) Go to your Xcode project’s “General”
settings. Drag RealmSwift.framework and Realm.framework from the
ios/swift-2.1.1/, watchos/, tvos/ or osx/swift-2.1.1/ directory to the
“Embedded Binaries” section. Make sure Copy items if needed is
selected and click Finish.</p>
</blockquote>

<p>基本上,说明我们需要使用不同的 Realm 库来为 Watch 和 iPhone 开发应用程序。</p>

<p>这里的问题是,如果我想创建 watchOS 应用程序,我需要导入特定于它的库。当我同时尝试为 iOS 导入库时,我从 xCode(版本 7.2.1)收到错误:</p>

<blockquote>
<p>Multiple errors occurred while copying the files</p>
</blockquote>

<p>无法同时添加两个库。</p>

<p>我的目标是按照 <a href="https://realm.io/news/tutorial-sharing-data-between-watchkit-and-your-app/" rel="noreferrer noopener nofollow">this</a> 中的说明在 Watch 和 iPhone 之间共享数据。文章,但即使有作者也缺少有关如何设置 2 个不同库的信息。</p>

<p>感谢任何帮助或建议。谢谢。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>添加 iOS 框架和 WatchKit 的框架时遇到的问题与我遇到的完全相同</p>

<p>我通过将两个文件夹 复制到我的 Xcode 项目文件夹中解决了这个问题,然后将各自的库添加到其目标的 Embedded Binaries 部分。</p>

<p>通过这种方式,您不会将同名项目复制到同一位置,也不会引发错误!</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何同时连接 Realm 与 watchOS 和 iOS 应用程序?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/35701858/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/35701858/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何同时连接 Realm 与 watchOS 和 iOS 应用程序?