如何更改 Xcode 中 Watchkitapp 和扩展的代码签名权利

How to change code signing entitlements in Xcode for Watchkitapp & Extension

我的应用程序可以正常编译和存档,但在上传到 Apple 商店时失败并显示以下错误消息:

Prepared archive for uploading Upload failed error: App Store Connect Operation Error ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value 'WF3BGN675V.net.brian-fitzgerald.changes' for key 'application-identifier' in 'Payload/I-Ching.app/Watch/watchkitapp.app/watchkitapp' is not supported. This value should be a string starting with your TEAMID, followed by a dot '.', followed by the bundle identifier."

error: App Store Connect Operation Error ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value 'WF3BGN675V.net.brian-fitzgerald.changes' for key 'application-identifier' in 'Payload/I-Ching.app/Watch/watchkitapp.app/PlugIns/watchkitapp Extension.appex/watchkitapp Extension' is not supported. This value should be a string starting with your TEAMID, followed by a dot '.', followed by the bundle identifier."

但显示的字符串是我的 TeamID,后跟一个点,后跟捆绑标识符!!!或者它是否期待 watchkit 的 bundleidentifier?因为如果是的话,它不会从 watchkit 应用程序的 info.plist 文件中获取它,它被分配给 net.brian-fitzgerald.changes.watchkitapp

我花了几个小时尝试在签署权限和配置文件、摆弄捆绑 ID 层次结构、清理、重建和重新清理方面尽我所能。我得到的唯一结果是构建失败或使用此消息构建成功。

我看过许多关于其他 ITMS-90046 错误的其他帖子,但没有涉及 watchkitapp 和扩展未报告正确的团队和捆绑语法。

我错过了什么?

更新:按照@Help 的建议,我通过删除文件本身以及从项目 plist 到它们的路径重新生成了我的权利文件。

问题仍然存在,但出现不同的错误消息:

而且 plist 包标识符和供应配置文件中的标识符之间没有不匹配。我的权利-Release.plist 是:

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>application-identifier</key>
    <string>WF3BGN675V.net.brian-fitzgerald.changes</string>
    <key>aps-environment</key>
    <string>production</string>
    <key>com.apple.security.application-groups</key>
    <array>
        <string>group.net.brian-fitzgerald.changes</string>
    </array>
</dict>
</plist>

找到了。真的浪费了好几天时间,我希望这能为其他人节省一些拉扯的头发。

info.plist 不是唯一分配 Watchkit 和 Watchkit 扩展包标识的地方。在 watchkit 应用程序和 watchkit 扩展目标的构建设置中有一个包标识符密钥:无论您在 info.plist 中输入什么,配置文件都会查找匹配项:

要么这些键是 Xcode 11 中的新键,要么它们在我的应用程序中总是设置错误。如果是后者,我怀疑 11 的发行说明中描述的行为是罪魁祸首:

Xcode removes some entries from the Info.plist file of a product at build time if the entries are not appropriate for the platform being built for, which is useful for targets which are configured to build for multiple platforms. This behavior can be disabled by setting the build setting DISABLE_INFOPLIST_PLATFORM_PROCESSING to YES, in which case the target must assume the responsibility of managing these entries appropriately. (47797497)

明确地说,我没有设置那个密钥,而是通过将 Watchkit 中的包标识符设置为

net.brian-fitzgerald.changes.watchkitapp

并在

的扩展中
net.brian-fitzgerald.changes.watchkitapp.watchkitextension

我能够将具有这些身份的配置文件分配给目标并正常构建和上传。

看到成功上传的绿色大复选标记,我从未如此高兴。我以为我的应用程序是吐司。如果我的分析是正确的,我希望 Apple 在下一个发行说明中记录这一点。我不可能是唯一一个会面对这个的人,而且日志记录纯粹是错误的。