Using Realm static framework


#1

I want to be able use the compiled static Realm.framework product in a Swift project. When running on the phone it throws an error - on app init - looking for a dynamic Realm framework.

dyld: Library not loaded: @rpath/Realm.framework/Realm
Referenced from: /private/var/containers/Bundle/Application/82BD0870-9769-488C-AE13-B20884C98C44/MyApp.app/Frameworks/MyAppCore.framework/MyAppCore
Reason: image not found
(lldb)

I don’t want it linking or embedding the Realm dynamic framework.

I am using git/git-subrepo to pull the Realm and ObjectStore repos into my main repo. My static frameworks are linked to a single dynamic framework - MyAppCore - that is the sole embedded dynamic framework in the app - it uses the Other_Linker_Flags -all_load -ObjC flags

I expected that dragging the static Realm.framework product from the Products group in the the Linked Frameworks and Libraries would suffice - as it does with every other static framework we use. However, when I drag the static product, the linked product in the Linked Frameworks list, points to the framework in …Build/Products/Debug-iphoneos and not Build/Products/Debug-iphoneos-static.

I am running Xcode 10.2.1, Realm 3.14.

What can I do to point to the correct Realm framework and make this work?