标识符为 <team-id.com.example.bundle-id> 的应用程序未与域 <www.example-domain.com> 相关联

Application with identifier <team-id.com.example.bundle-id> is not associated with domain <www.example-domain.com>

我正在为 iOS 开发一个本机库,该库旨在用于单点登录。 我需要与后端服务共享凭据,为此我遵循了以下步骤:(根据 FIDO2 标准和 this example

1。我在我的应用程序中启用了关联域

2。后端服务托管了 /.well-known/apple-app-site-assiciation.json

{
  "webcredentials": {
    "apps": [
      "<TEAM-ID>.<com.example.bundle-id>"
    ]
  }
}

我遇到的错误:

Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1004 "Application with identifier P896AB2AMC.com.trust.testsso is not associated with domain cerberus.trust.lat" UserInfo={NSLocalizedFailureReason=Application with identifier P896AB2AMC.com.trust.testsso is not associated with domain cerberus.trust.lat}
error in connection_block_invoke_2: Connection interrupted

我不知道我到底错过了什么。

看来你 site-association 有点不对。正确的 URL 是 https://<fully qualified domain>/.well-known/apple-app-site-association - 您使用的是 ...apple-app-site-association.json。把最后的 .json 去掉,就可以开始了。

有关完整说明,请参阅 https://developer.apple.com/documentation/xcode/supporting-associated-domains