Adding RealmSwift as a subproject: Lack of necessary modules: "Realm.Private", "Realm"

So, I wanted to link to RealmSwift in my own structure, and these are the steps I took:

  • Add RealmSwift as a subproject

    enter image description here

  • Tie the frames:

    enter image description here

  • Add a dependency

    enter image description here

  • Import RealmSwift into a Swift file:

    enter image description here

And I got the error: Missing required modules: 'Realm.Private', 'Realm' . How can I solve this problem? Thanks!

+3
source share
3 answers

You need to add /path/to/RealmSwift.framework/Frameworks in the "Wireframe Search Paths" section of the build settings

where /path/to/RealmSwift.framework is the location of the frame.

This is because RealmSwift.framework depends on Realm.framework (where the Realm and Realm.Private modules are Realm.Private ), which is sold in its Frameworks directory.

+3
source

As of v0.93.0 , RealmSwift.framework no longer builds Realm.framework. This results in the same missing module error message when updating. You can resolve this by linking directly to RealmSwift.framework and Realm.framework. You also need to remove any pre-existing strip-frameworks.sh. Run Script Phase in the target build phase of the application. This step is no longer needed.

+2
source

Something similar happened to me when I installed pod install ...

Make sure you open the appname.xcworkspace file and not the appname.xcodeproj after doing pod-install using CocoaPods.

Error There is no such module "RealmSwift" from any file where "import RealmSwift" is configured if it is not open from appname.xcworkspace.

0
source

Source: https://habr.com/ru/post/1263910/


All Articles