OGeek|极客世界-中国程序员成长平台

标题: ios - 如何同时连接 Realm 与 watchOS 和 iOS 应用程序? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:46
标题: ios - 如何同时连接 Realm 与 watchOS 和 iOS 应用程序?

所以,Realm 网站上有简单的说明:

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.

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

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

Multiple errors occurred while copying the files

无法同时添加两个库。

我的目标是按照 this 中的说明在 Watch 和 iPhone 之间共享数据。文章,但即使有作者也缺少有关如何设置 2 个不同库的信息。

感谢任何帮助或建议。谢谢。



Best Answer-推荐答案


添加 iOS 框架和 WatchKit 的框架时遇到的问题与我遇到的完全相同

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

通过这种方式,您不会将同名项目复制到同一位置,也不会引发错误!

关于ios - 如何同时连接 Realm 与 watchOS 和 iOS 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35701858/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4