本文介绍了Cocoapod RealmSwift运行时错误:`dyld:库未加载:@ rpath/Realm.framework/Realm`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个以前可以在设备上正常运行的项目,但是在我重新安装了cocoapods之后它开始失败.奇怪的是,我在模拟器中运行时没有遇到问题.我还能够通过一个全新的项目来复制相同的问题.确切的错误是:

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'

我尝试过的事情:

  • 删除派生数据,清理Xcode项目,重新启动xcode
  • 删除设备上的应用,重新插入USB
  • 已清除的可可足类缓存
  • 已更新为最新的RealmSwift

对于任何想尝试的人,这里都是一个示例项目: https://github.com/schystz/TestRealmSwift

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

推荐答案

显然,问题的原因是Xcode自动创建的开发证书.在我手动创建证书后(即通过上传csr,下载并添加到钥匙串),此问题已得到解决.我不确定为什么Xcode会像这样导致以前自动签名工作正常...

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

这篇关于Cocoapod RealmSwift运行时错误:`dyld:库未加载:@ rpath/Realm.framework/Realm`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 22:48