ios - Xcode 上的 RealmSwift 安装

标签 ios swift cocoapods realm

我正在尝试创建一个使用 Realm 和 RealmSwift 的项目。我已经使用 Cocoapods 来安装这些依赖项。我也在 stackoverflow 上看到了其他帖子并尝试了他们的解决方案。他们不适合我。在我的项目中,当我编写 import RealmSwift 语句时,出现错误“No such module as RealmSwift”。以下是我的安装步骤:

  1. 我创建了一个空的 xcode 项目
  2. 我进入终端并导航到我的项目目录
  3. 我使用了 pod init 命令来创建 pod 文件
  4. 我进入了 pod 文件(它已经有 use_frameworks! 语句
  5. 我在 pod 'Realm'pod 'RealmSwift' 中编写。我给出的来源为:

    来源'https://github.com/artsy/Specs.git '

    来源'https://github.com/CocoaPods/Specs.git '

enter image description here

  • 我在pod install中写道
  • Pod 已成功安装。我进入了 .xcworkspace 文件。
  • 我已经安装了 Realm 插件,因此我创建了一个新的 Realm 对象文件
  • 模板文件将打开并包含以下文件。我收到没有 RealmSwift 模块的错误。
  • enter image description here

    我做错了什么?或者我没有做什么?是否需要桥接头?有其他人设法解决此错误吗?

    非常欢迎任何相关建议或见解。

    最佳答案

    现在可以使用了!这太奇怪了,因为我什么也没做。我刚刚进入我的 pod 文件,注释掉了 use_frameworks!语句并在终端上运行pod update。它给了我一个错误,所以我将它添加回我的 pod 文件中。我再次在pod update中写入并按回车键。我重新启动 Xcode,清理它并构建它,我不再收到此错误。

    关于ios - Xcode 上的 RealmSwift 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38352111/

    相关文章:

    cocoapods - 代码 : Failed to render and update auto layout status for UIView: the agent crashed

    ios - 对使用 faSTLane 构建的应用程序进行代码签名,并将 CocoaPods 构建为动态框架

    iphone - 应用在后台运行时访问和保存位置信息 - iOS

    ios - UITableViewController 不显示自定义原型(prototype)单元格

    java - 需要什么才能将 JPanel 和 JButton 转换为与 IOS 一起使用,以避免 “headless” 错误?

    ios - 基于时间执行功能

    ios - NSLayoutConstraint 的幽灵困扰着我的 View 层次结构?

    arrays - SWIFT:大量字符串的快速累积

    ios - Alamofire - 如何获取表中的记录数

    ios - 必须先配置默认 FirebaseApp 实例,然后才能初始化 defaultFirebaseApp 实例