Poles Poles - 1 month ago 21
Objective-C Question

dyld: Library not loaded: @rpath/Realm.framework/Realm error with Realm Objective C framework

I have installed the Realm Objective C Framework (2.0.3) by simply dragging it into my project created in Xcode 8. When I first tried it on simulator I got the typical dyld error.

dyld: Library not loaded: @rpath/Realm.framework/Realm
Referenced from: /var/containers/Bundle/Application/89F5987A-F3F0-45F2-9014-6BA662135E00/RelamDemo.app/RelamDemo
Reason: image not found


So I tried to fix it using the following suggestion:
https://github.com/realm/realm-cocoa/issues/1681#issuecomment-120749962

And it worked on iOS 10 Simulators.

But when I tried to run the same project on a device (iOS 10/9.3.2) I got the same dyld error again.

I have checked that I have copied the Realm.framework in my project. Now how can I solve the problem?

TiM TiM
Answer

You need to ensure that Realm.framework is also copied to the 'Embedded Binaries' section of your app as well.

You can find that section in the 'General' tab of your project's settings.

Embedded Binaries

(Screenshot courtesy of this iOSDevCenter post)