包含钥匙串访问权限时,导出的MacOS应用程序崩溃,并出现dyld错误

问题描述

我有一个MacOS应用程序,我已经能够将其导出多年而没有出现问题。最近,我不得不添加功能“钥匙串共享”,尽管该应用程序在调试器中仍然可以正常运行,但是在导出时,该应用程序崩溃并显示以下详细信息。这同时使用了XCode 11.6和12.0.1

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000,0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD,[0x5] Code Signature

Application Specific information:
dyld: launch,loading dependent libraries

Dyld Error Message:
  Library not loaded: @loader_path/../Frameworks/GTLRDrive.framework/Versions/A/GTLRDrive
  Referenced from: /Users/Gerrit/Documents/*/[app name].app/Contents/MacOS/xxx
  Reason: no suitable image found.  Did find:
    /Users/Gerrit/Documents/Releases/[app name] 2033b/[app name].app/Contents/MacOS/../Frameworks/GTLRDrive.framework/Versions/A/GTLRDrive: code signature invalid for '/Users/Gerrit/Documents/Releases/[app name] 2033b/[app name].app/Contents/MacOS/../Frameworks/GTLRDrive.framework/Versions/A/GTLRDrive'

    /Users/Gerrit/Documents/Releases/[app name] 2033b/[app name].app/Contents/MacOS/../Frameworks/GTLRDrive.framework/Versions/A/GTLRDrive: stat() Failed with errno=1
    /Users/Gerrit/Documents/Releases/[app name] 2033b/[app name].app/Contents/MacOS/../Frameworks/GTLRDrive.framework/Versions/A/GTLRDrive: code signature invalid for '/Users/Gerrit/Documents/Releases/[app name] 2033b/[app name].app/Contents/MacOS/../Frameworks/GTLRDrive.framework/Versions/A

这是没有钥匙串共享的“签名和功能标签的样子:

Signing and Capabilities without Keychain sharing

一旦我添加功能钥匙串共享,就需要一个Xcode托管的配置文件,该文件将更改为:

Signing and Capabilities with Keychain sharing

两种情况下的构建设置都相同:

Build Settings - code signing

我当然已经将框架设置为嵌入并在“常规”标签中签名。

导出摘要也看起来不错:

enter image description here

在SO上描述了几个行业问题+解决方案,我做了很多尝试: 删除证书,然后让Xcode重新创建它们,清理项目,手动删除缓存,重新启动几次。我检查了有和没有钥匙串共享的导出的包装内容,它们看起来和我一样-除了embedded.provisioningprofile以外(没有钥匙串共享的导出不属于导出的一部分)

有什么想法会导致这种情况,以及如何解决

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)