问题
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