Xcode 上的 RealmSwift 安装
RealmSwift installation on Xcode
我正在尝试创建一个使用 Realm 和 RealmSwift 的项目。我已经使用 Cocoapods 来安装这些依赖项。我也在 Whosebug 上看过其他帖子并尝试了他们的解决方案。他们不为我工作。在我的项目中,当我编写 import RealmSwift
语句时出现错误 "No such module as RealmSwift"
。以下是我的安装步骤:
- 我创建了一个空的 xcode 项目
- 我进入终端并导航到我的项目目录
- 我给了
pod init
命令来创建一个pod文件
- 我进入了 pod 文件(它已经有了
use_frameworks!
语句
我写在pod 'Realm'
和pod 'RealmSwift'
。我给出的来源是:
- 我写在
pod install
- pods安装成功。我进入了 .xcworkspace 文件。
- 我已经安装了领域插件,所以我创建了一个新的领域对象文件
- 模板文件打开时包含以下文件。我收到没有 RealmSwift 模块的错误。
我做错了什么?或者我没有做什么?是否需要桥接头?有其他人设法解决此错误吗?
欢迎提出任何相关建议或见解。
现在可以使用了!太奇怪了,因为我什么都没做。我刚刚进入我的 pod 文件并注释掉 use_frameworks!语句和 运行 pod update
在终端上。它给了我一个错误,所以我将它添加回我的 pod 文件。我再次输入 pod update
并按下回车键。我重新启动 Xcode 清理并构建了它,我不再收到此错误。
需要在您的 pod 文件中取消对平台的注释,然后再次尝试您的 pod。
# Uncomment this line to define a global platform for your project
platform :ios, '9.0' // Uncomment this
# Uncomment this line if you're using Swift
use_frameworks!
target 'Demo_Realm' do
pod 'RealmSwift'
end
target 'Demo_RealmTests' do
end
target 'Demo_RealmUITests' do
end
我正在尝试创建一个使用 Realm 和 RealmSwift 的项目。我已经使用 Cocoapods 来安装这些依赖项。我也在 Whosebug 上看过其他帖子并尝试了他们的解决方案。他们不为我工作。在我的项目中,当我编写 import RealmSwift
语句时出现错误 "No such module as RealmSwift"
。以下是我的安装步骤:
- 我创建了一个空的 xcode 项目
- 我进入终端并导航到我的项目目录
- 我给了
pod init
命令来创建一个pod文件 - 我进入了 pod 文件(它已经有了
use_frameworks!
语句 我写在
pod 'Realm'
和pod 'RealmSwift'
。我给出的来源是:
- 我写在
pod install
- pods安装成功。我进入了 .xcworkspace 文件。
- 我已经安装了领域插件,所以我创建了一个新的领域对象文件
- 模板文件打开时包含以下文件。我收到没有 RealmSwift 模块的错误。
我做错了什么?或者我没有做什么?是否需要桥接头?有其他人设法解决此错误吗?
欢迎提出任何相关建议或见解。
现在可以使用了!太奇怪了,因为我什么都没做。我刚刚进入我的 pod 文件并注释掉 use_frameworks!语句和 运行 pod update
在终端上。它给了我一个错误,所以我将它添加回我的 pod 文件。我再次输入 pod update
并按下回车键。我重新启动 Xcode 清理并构建了它,我不再收到此错误。
需要在您的 pod 文件中取消对平台的注释,然后再次尝试您的 pod。
# Uncomment this line to define a global platform for your project
platform :ios, '9.0' // Uncomment this
# Uncomment this line if you're using Swift
use_frameworks!
target 'Demo_Realm' do
pod 'RealmSwift'
end
target 'Demo_RealmTests' do
end
target 'Demo_RealmUITests' do
end