xcode 无法加载“RealmSwift”的底层模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36216735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot load underlying module for 'RealmSwift'
提问by patrikbelis
I'm trying to install Realm for Swift via Cocoapods.
我正在尝试通过 Cocoapods 为 Swift 安装 Realm。
First what I did was pod initinto my project
Then I open podfile and changed it like this:
首先我做的是pod init到我的项目
然后我打开 podfile 并像这样改变它:
target 'Taskio' do
use_frameworks!
pod 'RealmSwift'
end
Then I closed podfile and execute command pod install
然后我关闭 podfile 并执行命令pod install
Everything pass good. But now when i opened workspace I'm getting error while importing RealmSwift
一切都过得很好。但是现在当我打开工作区时,我在导入 RealmSwift 时遇到错误
Cannot load underlying module for 'RealmSwift'
无法加载“RealmSwift”的底层模块
采纳答案by Oleg Gordiichuk
Firstly try to check what workspace you open after cocoapods were install open App.xcworkspacefile.If yes open Pods directory and check if file is actually installed by manually navigation to REALMfolder. After navigation to this articleit is possible to conclude that you should:
首先尝试检查安装cocoapods后打开的工作区打开App.xcworkspace文件。如果是打开Pods目录并通过手动导航到REALM文件夹检查文件是否实际安装。导航到本文后,可以得出结论,您应该:
New project -> build&run -> add realm via cocoapods -> open Xcode workspace -> build&run again = success
新建项目 -> 构建&运行 -> 通过 cocoapods 添加领域 -> 打开 Xcode 工作区 -> 再次构建&运行 = 成功
回答by swiftBoy
Once you have installed RealmSwift pod.
一旦你安装了 RealmSwift pod。
Step.1you should open your project by double click on your_project_name.xcworkspacefile.
Step.1您应该通过双击your_project_name.xcworkspace文件打开您的项目。
Step.2Go to project settings --> Build Phases --> Link Binary with Libraries --> Add framework "RealmSwift.framework" as shown below
Step.2进入项目设置 --> Build Phases --> Link Binary with Libraries --> 添加框架“RealmSwift.framework”,如下图
That it!!
那个!!
Now you can import the module
现在您可以导入模块
回答by Anil Kukadeja
As far as I think I had the same problem with ObjectMapper Framework. What I did is just opened myapp.xcworkspace and press command + b. All things worked fine after this. Strange error in Xcode.
就我而言,我认为 ObjectMapper 框架也有同样的问题。我所做的只是打开 myapp.xcworkspace 并按 command + b。在此之后,一切都运行良好。Xcode 中的奇怪错误。
回答by Jeacovy Gayle
xCode version:Version 9.0 (9A235)
xCode 版本:版本 9.0 (9A235)
Mac OS High Sierra:10.13.1 Beta (17B25c)
Mac OS High Sierra:10.13.1 测试版 (17B25c)
- Close xCode
- Delete Pods Folder and Podfile.lock
- 关闭 xCode
- 删除 Pods 文件夹和 Podfile.lock
- In the terminal run a "pod install" after cd'ing into the project directory.
- Open xCode and Build Project.
- cd 进入项目目录后,在终端中运行“pod install”。
- 打开 xCode 并构建项目。
Good Luck!
祝你好运!