Flutter / Swift 编译器错误(Xcode):在范围内找不到“ExternalLinkAccount”

问题描述 投票:0回答:1

自2022年10月12日起,具有外部账户管理/购买功能的读者应用必须申报新的授权。

外链帐号 允许符合条件的应用程序链接到外部网站以创建或管理帐户。 https://developer.apple.com/documentation/storekit/external_link_account

我不能建造因为:

Swift Compiler Error (Xcode): Cannot find 'ExternalLinkAccount' in scope

  1. 配置 SKExternalLinkAccount 属性列表键。
<plist>
<dict>
    <key>SKExternalLinkAccount</key>
    <dict>
        <key>*</key>
        <string>https://example.com</string>
        <key>jp</key>
        <string>https://example.com/jp</string>
    </dict>
</dict>
</plist>
  1. 跑步者列表
<key>com.apple.developer.storekit.external-link.account</key>
<true/>
  1. 跑步者权利
<plist>
<dict>
    <key>com.apple.developer.storekit.external-link.account</key>
    <true/>
</dict>
</plist>
  1. ios 构建(带 flutter run):
Swift Compiler Error (Xcode): Cannot find 'ExternalLinkAccount' in scope
  1. 我在自定义 swift 文件中的代码(使用特定于平台的调用调用)
import SwiftUI

struct ExternalLinkAccountModal: View {

    var body: some View {
    Text("Hello, world!")
        .padding()
        .onAppear {
            Task {
                await executeTask()
            }
        }
    }
}

struct ExternalLinkAccountModal_Previews: PreviewProvider {
    static var previews: some View {
        ExternalLinkAccountModal(onConfirm: nil, onCancel: nil)
            .previewDevice("iPhone 13")
            .previewInterfaceOrientation(.portrait)
    }
}



func executeTask() async {
    let basicTask = Task {
        if await ExternalLinkAccount.canOpen {
            do {
                try await ExternalLinkAccount.open()
            } catch {
                print("ExternalLinkAccount.open() error \(error)")
            }
        }
    }
}
  1. 配置文件 我的配置文件配置良好并被 Apple Developper 接受:
Associated Domains, External Link Account, In-App Purchase, Push Notifications

你能帮忙解决这个问题吗?

我正在使用 osx Ventura 和 ios16 平台进行开发。

ios swift flutter build entitlements
1个回答
0
投票

您可能需要:

import StoreKit
© www.soinside.com 2019 - 2024. All rights reserved.