Cannot load underlying module for 'RealmSwift'

旧街凉风 提交于 2019-12-06 19:37:04

问题


I'm trying to install Realm for Swift via Cocoapods.

First what I did was pod init into my project

Then I open podfile and changed it like this:

target 'Taskio' do
use_frameworks!
pod 'RealmSwift'

end

Then I closed podfile and execute command pod install

Everything pass good. But now when i opened workspace I'm getting error while importing RealmSwift

Cannot load underlying module for 'RealmSwift'


回答1:


Firstly try to check what workspace you open after cocoapods were install open App.xcworkspace file.If yes open Pods directory and check if file is actually installed by manually navigation to REALM folder. After navigation to this article it is possible to conclude that you should:

New project -> build&run -> add realm via cocoapods -> open Xcode workspace -> build&run again = success




回答2:


Once you have installed RealmSwift pod.

Step.1 you should open your project by double click on your_project_name.xcworkspace file.

Step.2 Go to project settings --> Build Phases --> Link Binary with Libraries --> Add framework "RealmSwift.framework" as shown below

That it!!

Now you can import the module




回答3:


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.




回答4:


xCode version: Version 9.0 (9A235)

Mac OS High Sierra: 10.13.1 Beta (17B25c)

  1. Close xCode
  2. Delete Pods Folder and Podfile.lock

  1. In the terminal run a "pod install" after cd'ing into the project directory.
  2. Open xCode and Build Project.

Good Luck!



来源:https://stackoverflow.com/questions/36216735/cannot-load-underlying-module-for-realmswift

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!