SwiftUI 中如何管理应用内购买的订阅

发布
更新
字数 68
阅读 1 分钟
阅读量 902

StoreKit 提供了多个 View 修改器,用于管理应用内购买项目

显示其他 App appStoreOverlay(isPresented:configuration:)

// some View
.appStoreOverlay(isPresented: $isSubscriptionsSheetPresented, configuration: {
    SKOverlay.AppConfiguration(appIdentifier: "The iTunes identifier of another app.", position: .bottom)
})

管理订阅 manageSubscriptionsSheet(isPresented:)

// some View
.manageSubscriptionsSheet(isPresented: $isSubscriptionsSheetPresented)

其他

  • 退费 refundRequestSheet(for:isPresented:onDismiss:)
  • 输入优惠码 offerCodeRedemption(isPresented:onCompletion:)