RealmSwift: No such module 'RealmSwift'

时光怂恿深爱的人放手 提交于 2020-02-21 10:28:26

问题


I configured RealmSwift 1.0.0 Latest Using Docs into the Xcode project. After installation i created a class file and getting module error - like: No such module 'RealmSwift' in class file.

1.

2.

3.

4.

  1. After adding the Realm Plugin, i created a class and get the module error below.

Please help me to solve this error.


回答1:


It looks like you've added the path to RealmSwift.framework to your framework search paths. The Realm Swift installation instructions say to add the parent path of RealmSwift.framework (i.e., the containing directory) to your framework search paths.




回答2:


A very important sanity check: if you run into this and you're using Cocoapods, please make sure you open the .xcworkspace and not the .xcodeproj file!




回答3:


Follow below steps, it may be useful for you.

  • Go To: Product > Schemes > New Scheme...
  • Select: RealmSwift and click OK
  • Build the RealmSwift target (cmd + b)



回答4:


I had the same problem like you. I resolved it by add the following code into pod file.

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'



回答5:


I've struggled with this problem as well for 2 hours; I tried several things, like cleaning, uninstalling and reinstalling the Realm pod, changing the Podfile, and so on.

Nothing worked until I restarted the computer.

I use Xcode 8.3.3 and Xcode 9.2 Beta, Swift 3, High Sierra MacOS.




回答6:


Follow below instructions:

  1. Clean from Xcode (Shift+Cmd+K)
  2. Delete the Derived Data directory (~/Library/Developer/Xcode/DerivedData)
  3. Build the project (Cmd+B)



回答7:


After "pod install" restart Xcode




回答8:


You can add Run script file for your project.

"${SRCROOT}/Pods/Target Support Files/Pods-Realm Database/Pods-Realm Database-frameworks.sh"



回答9:


You can check executable file. The executable file is not xcodeproj file. The executable xcworkspace file.




回答10:


let me tell you How I get that error and I solve it.

I am using Carthage in my project. but I am new team member, so I did git-clone the project. But I opened the project before run cathage upload command. Although I ran the cathage command, I got that error. I could fix it doing the next:

Go to the project file. In build phaces -> run script -> Input file. Add $(SRCROOT)/Carthage/Build/iOS/Realm.framework And $(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework

I do not know why it is not always automatically linked .

Best Regards!




回答11:


For me there first was an error like 'could not build Objective-C module 'RealmSwift'' which I could fix by deleting the Derived Data Folder, Pods Folder, Podfile.lock and the .xcworkspace and after that there was the error saying 'No such module 'RealmSwift'' which only disappeared when I first tried to build the project. Now everything works fine for me!



来源:https://stackoverflow.com/questions/37682919/realmswift-no-such-module-realmswift

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