Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open the subscriptions page of the App Store app programmatically?

If you have a subscription with two different possible lengths in your iOS app, and the user, who has purchased the shorter subscription, decides to purchase the longer subscription instead, they get prompted with this dialog:

enter image description here

Tapping Settings takes the user to the App Store app and opens the page where they can manage their subscriptions. Most probably Cocoa simply uses a custom scheme URL (e.g. appstore://pages/subscriptions) to achieve this.

What is this URL? Is there another way to open the subscriptions page in the App Store app programmatically?

like image 603
Alexey Blinov Avatar asked Feb 20 '12 03:02

Alexey Blinov


2 Answers

I really think that this is impossible, because when you add a payment to your SKPaymentQueue, and the alertView shows up, your app is no longer active – app store manages eveything outside your app, because later applicationWillResignActive callback is called.

That means, that it was inActive, and the thing you want to do can't be accessed inside your app.

like image 71
Nikita Pestrov Avatar answered Sep 30 '22 19:09

Nikita Pestrov


The subscription docs suggest that you can open the subscriptions management page using the following URL

https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html#//apple_ref/doc/uid/TP40008267-CH7-SW8

So something like

        let subscriptionURL = URL.init(string: "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions")!
        UIApplication.shared.open(subscriptionURL)

this does work; though it's somewhat indirect. The link opens in Safari which then redirects through to the store link. The redirect is actually to

itmss://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions

so I'm using that directly in my app - though of course it isn't guaranteed to be stable.

NB: Sandbox Subscriptions will not appear in this page. You'll have to do a trial signup to some other live service to have anything to see when you test.

like image 21
Confused Vorlon Avatar answered Sep 30 '22 20:09

Confused Vorlon