StoreKit 2 - 产品请求始终为空
我尝试使用 StoreKit 2
从 App Store Connect
获取产品,但始终返回空数组:
let keys = [
"com.app.suscripcion.mes.1"
]
let storeProducts = try await Product.products(for: keys)
我在 InApp Purchase< 上添加了一个密钥/code> 部分:
我需要做什么才能从 App Store Connect
获取产品?如果我使用 .storekit
配置文件,它可以工作,但在真实场景中不起作用
I'm trying to fetch the products from the App Store Connect
using StoreKit 2
but always returns an empty array:
let keys = [
"com.app.suscripcion.mes.1"
]
let storeProducts = try await Product.products(for: keys)
I had added a key on the InApp Purchase
section:
What do I have to do to fetch the products from the App Store Connect
? If I use a .storekit
configuration file it works but with a real scenario doesn't work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要解决此问题,
App Store Connect
中的帐户持有人
需要在协议、税务和银行业务
内设置税务和银行业务
到付费应用程序,以便从App Store Connect
获取应用内购买产品:之后,付费应用程序类型的状态需要更改为
活动 才能使其正常工作。
To solve this problem, the
Account Holder
fromApp Store Connect
, insideAgreements, Tax, and Banking
, needs toSet Up Tax and Banking
to Paid Apps in order to get the InApp Purchase products fromApp Store Connect
:After that, the Status for the Paid Apps Type need to change to
Active
in order to make it work.检查执行的方案的选项中的 StoreKit Configuration 值是否设置为 none。
Check if the StoreKit Configuration value is set to none in the options of the scheme that was executed.
确保您在此方法中传递了产品或订阅的标识符,而不是错误地传递了应用程序的捆绑包标识符:
尝试等待 Product.products(for: ["my_monthly_subscription"])
✅尝试等待 Product.products(for: ["com.mycompany.myapp"])
❌Make sure you're passing the identifier of the Product or Subscription in this method and not the app's bundle identifier by mistake:
try await Product.products(for: ["my_monthly_subscription"])
✅try await Product.products(for: ["com.mycompany.myapp"])
❌