29

我想创建一个按钮,用户可以在其中取消自动续订订阅(或重定向到 App Store)。

如果用户不必先完成整个购买过程,这是否可能?如果是,你会怎么做?

4

5 回答 5

42

2019 年 12 月

根据Apple 的处理订阅计费文档,正确的 URL 现在是https://apps.apple.com/account/subscriptions

所以只需使用:

UIApplication.shared.open(URL(string: "https://apps.apple.com/account/subscriptions")!)
于 2019-10-28T16:56:35.270 回答
35

来自 Apple In-App Purchase Programming Guide -

您的应用无需编写自己的订阅管理 UI,而是可以打开以下 URL:

https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions 打开此 URL 会启动 iTunes 或 iTunes Store,然后显示“管理订阅”页面。

因此,只需创建一个启动该 URL 的按钮。

UIApplication.shared.openURL(URL(string: "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions")!)
于 2015-08-24T11:00:05.000 回答
3

如文档中所述: https ://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html#//apple_ref/doc/uid/TP40008267-CH7-SW19

所以对于 Swift 3/4 只需使用这个

UIApplication.shared.openURL(URL(string: "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions")!)
于 2018-05-28T06:33:19.070 回答
0

iOS 10 及更高版本

UIApplication.shared.open(URL(string: "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions")!, options: [:], completionHandler: nil)
于 2019-05-09T03:53:42.637 回答
-1

2021 年 4 月

根据Apple Document,该 URL 已更新为

https://apps.apple.com/account/subscriptions

因此,可以使用以下代码将用户重定向到管理订阅页面。

DispatchQueue.main.async {
      UIApplication.shared.open(URL(string: "https://apps.apple.com/account/subscriptions")!, options: [:], completionHandler: nil)
    }
于 2021-04-05T09:36:01.877 回答