如何正确请求应用程序审核?

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

我发现下面的文章似乎是人们应该用来请求审查自己的应用程序的文章:

https://developer.apple.com/documentation/storekit/requesting_app_store_reviews

我实现了那里的内容,看起来效果很好。但是,我确实在 Xcode 中的“await requestReview()”行上收到警告:

@Environment(\.requestReview) private var requestReview


/// Presents the rating and review request view after a two-second delay.
private func presentReview() {
    Task {
        // Delay for two seconds to avoid interrupting the person using the app.
        try await Task.sleep(for: .seconds(2))
        await requestReview() // Warning here...
    }
}

警告是:

await 表达式中不会发生异步操作

我理解这是技术上的,因为它说 requestReview() 调用不是异步的,但这是苹果代码,所以不确定是否有更新的方法来执行此操作或执行其他操作。

请注意,我必须将应用程序的最低版本设置为 ios 16,它不适用于 15 或更早版本。

swiftui storekit
1个回答
0
投票

此演示代码中的

requestReview
是异步的(或者更确切地说:它在
@MainActor
隔离上下文中运行,因此
await
:

@主要演员

var requestReview: RequestReviewAction { 获取 }

您可能收到的警告是

requestReview
,它已被弃用。

我不知道为什么你的 Xcode 会变得混乱。我尝试使用 Xcode 15.2,但无法重现此问题。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.