Xcode上的RealmSwift安装 [英] RealmSwift installation on Xcode

查看:430
本文介绍了Xcode上的RealmSwift安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个使用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:

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

  1. I created an empty xcode project
  2. I went into terminal and navigated to my project directory
  3. I gave the pod init command to create a pod file
  4. I went into the pod file(it already had the use_frameworks! statement
  5. I wrote in pod 'Realm' and pod 'RealmSwift'. I gave the sources as:

source' https://github.com/artsy/Specs.git '

source' https://github.com/CocoaPods/Specs.git '

  1. 我在pod install
  2. 中写过
  3. 吊舱已成功安装.我进入了.xcworkspace文件.
  4. 我已经安装了领域插件,所以我创建了一个新的领域对象文件
  5. 模板文件随以下文件一起打开.我收到没有RealmSwift模块的错误.
  1. I wrote in pod install
  2. The pods were installed successfully. I went into the .xcworkspace file.
  3. I had already installed the realm plugin so I created a new realm object file
  4. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆