schystz
schystz

Reputation: 800

Cocoapod RealmSwift runtime error: `dyld: Library not loaded: @rpath/Realm.framework/Realm`

I have a project that used to work fine on the device but it started failing after I have re-installed cocoapods. The weird thing is I don't get the problem while running in the simulator. I was also able to replicate the same problem with a completely new project. The exact error was:

dyld: Library not loaded: @rpath/Realm.framework/Realm
  Referenced from: /var/containers/Bundle/Application/34C8D121-9724-4C73-9B62-6F8932E5BFD7/myapp.app/myapp
  Reason: no suitable image found.  Did find:
    /private/var/containers/Bundle/Application/34C8D121-9724-4C73-9B62-6F8932E5BFD7/myapp.app/Frameworks/Realm.framework/Realm: code signing blocked mmap() of '/private/var/containers/Bundle/Application/34C8D121-9724-4C73-9B62-6F8932E5BFD7/myapp.app/Frameworks/Realm.framework/Realm'
    /private/var/containers/Bundle/Application/34C8D121-9724-4C73-9B62-6F8932E5BFD7/myapp.app/Frameworks/Realm.framework/Realm: code signing blocked mmap() of '/private/var/containers/Bundle/Application/34C8D121-9724-4C73-9B62-6F8932E5BFD7/myapp.app/Frameworks/Realm.framework/Realm'
    /private/var/containers/Bundle/Application/34C8D121-9724-4C73-9B62-6F8932E5BFD7/myapp.app/Frameworks/Realm.framework/Realm: code signing blocked mmap() of '/private/var/containers/Bundle/Application/34C8D121-9724-4C73-9B62-6F8932E5BFD7/myapp.app/Frameworks/Realm.framework/Realm'

What I have tried:

For anyone who wants to try, here's a sample project: https://github.com/schystz/TestRealmSwift

Upvotes: 2

Views: 551

Answers (2)

Edward Gray
Edward Gray

Reputation: 1

I had the same issue in Xcode 11.4 and I fixed it by editing my pod file to:

platform :ios, '13.0'

target 'YourTarget' do
  #use_frameworks! -> !!! very important

  pod 'Realm', :modular_headers => true
  pod 'RealmSwift', :modular_headers => true

end

Upvotes: 0

schystz
schystz

Reputation: 800

Apparently, the cause of the issue is a development certificate that was automatically created by Xcode. The issue was fixed after I created the certificate manually (that is by uploading my csr, downloading and adding to keychain). I'm not sure why Xcode is like this cause automatic signing used to work before...

Upvotes: 1

Related Questions