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

一曲冷凌霜 提交于 2019-12-11 17:00:29

问题


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:

  • deleting derived data, cleaning Xcode project, restart xcode
  • removing the app on device, re-plugging the usb
  • cleared cocoapod cache
  • updated to latest RealmSwift

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


回答1:


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...



来源:https://stackoverflow.com/questions/46255668/cocoapod-realmswift-runtime-error-dyld-library-not-loaded-rpath-realm-frame

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