首页 > 解决方案 > 即使我做了深度清理并重新安装 Xcode,也无法在设备上运行 Xcode 项目,钥匙串总是出错

问题描述

一切都运行良好,在模拟器和我的三台测试设备(iPhone 8、iPhone 8 plus 和当前的 iPhone 11 (iOS 11.3.1))上运行多个项目,直到刚刚开始出现这个错误,当我正在尝试在设备上运行项目。在模拟器上,它仍然运行良好。

经历了许多建议的步骤,StackOverflow 的答案,甚至我清理了与 XCode 相关的所有内容(当时我已经在 11.4 上更新了 XCode):删除~/Library/Developer/~/Library/Caches/com.apple.dt .Xcodeand ; 重新安装它,现在它仍然无法正常工作。

这变得非常令人沮丧,我非常感谢已经遇到这个问题的人的帮助,我希望已经解决了这个问题。

完整的堆栈跟踪

dyld: Library not loaded: @rpath/KeychainAccess.framework/KeychainAccess
  Referenced from: /private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/MyiOS
  Reason: no suitable image found.  Did find:
    /private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess: code signature invalid for '/private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess'

    /private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess: stat() failed with errno=25
    /private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess: code signature invalid for '/private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess'

    /private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess: stat() failed with errno=1
    /private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess: code signature invalid for '/private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess'

    /private/var/containers/Bundle/Application/E94B4D8B-47A3-49BC-A6D7-22A5C1914A23/MyiOS.app/Frameworks/KeychainAccess.framework/KeychainAccess: stat() failed with errno=1

标签: iosswiftiphonexcodekeychain

解决方案


伙计们,回答你自己的问题很奇怪,但如果有人遇到这个问题,这对我有用,因为乍一看,这是一个没有希望的例子。

这适用于所有将在某个时刻使用 iOS 11.3.1 的人 - 很有机会获得这个。

不管你信不信,你所要做的就是评论你的 Podfile 行 use_frameworks!它有效。

参考并感谢这篇文章: https ://github.com/Alamofire/Alamofire/issues/3051#issuecomment-580003683


推荐阅读