Xcode上的RealmSwift安装 [英] RealmSwift installation on Xcode
问题描述
我正在尝试创建一个使用Realm和RealmSwift的项目.我已经使用Cocoapods安装了这些依赖项.我在stackoverflow上也看到了其他帖子,并尝试了他们的解决方案.他们不为我工作.在我的项目中,编写import RealmSwift
语句时出现错误"No such module as RealmSwift"
.这是我执行的安装步骤:
I am trying to create a project which uses Realm and RealmSwift. I have used Cocoapods to install these dependencies. I have seen the other posts too on stackoverflow and tried their solutions. They don't work for me. In my project, I'm getting the error "No such module as RealmSwift"
when I write the import RealmSwift
statement. Here are the steps I took for installation:
- 我创建了一个空的xcode项目
- 我进入终端并导航到我的项目目录
- 我给出了
pod init
命令来创建Pod文件 - 我进入了pod文件(它已经有
use_frameworks!
语句 -
我在
pod 'Realm'
和pod 'RealmSwift'
中写过.我给出了以下来源:
- I created an empty xcode project
- I went into terminal and navigated to my project directory
- I gave the
pod init
command to create a pod file - I went into the pod file(it already had the
use_frameworks!
statement I wrote in
pod 'Realm'
andpod 'RealmSwift'
. I gave the sources as:
source' https://github.com/artsy/Specs.git '
source' https://github.com/CocoaPods/Specs.git '
- 我在
pod install
中写过
- 吊舱已成功安装.我进入了.xcworkspace文件.
- 我已经安装了领域插件,所以我创建了一个新的领域对象文件
- 模板文件随以下文件一起打开.我收到没有RealmSwift模块的错误.
- I wrote in
pod install
- The pods were installed successfully. I went into the .xcworkspace file.
- I had already installed the realm plugin so I created a new realm object file
- The template file opens with the following file. I'm getting the error that there is no RealmSwift module.
我做错了什么?还是我在做什么?是否需要桥接头?还有其他人设法解决此错误吗?
What am I doing wrong? Or what am I not doing? Is a bridging header required? Has anybody else managed to resolve this error?
任何相关的建议或见解都将受到欢迎.
Any relevant suggestions or insights are most welcome.
推荐答案
现在可以使用了!因为我什么也没做,所以很奇怪.我刚进入我的pod文件,将use_frameworks注释掉了!语句并在终端上运行pod update
.它给了我一个错误,所以我将其添加回了我的pod文件.我再次在pod update
中编写并按Enter.我重新启动了Xcode,将其清理并构建,但现在不再出现此错误.
Its working now! Its so weird since I didn't do anything. I just went into my pod file commented out the use_frameworks! statement and ran pod update
on the terminal. It gave me an error, so I added it back to my pod file. I wrote in pod update
again and hit enter. I restarted Xcode cleaned it and built it and I wasn't getting this error anymore.
这篇关于Xcode上的RealmSwift安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!