esilver
esilver

Reputation: 28473

How to present a UIViewController containing iOS App Store, with Done button

According to Apple, to launch to the iOS App Store from within an App, you must pass an app store link (https://itunes.apple.com/us/app/apple-store/id375380948?mt=8) to UIApplication.shared.open.

When you call this method, you get a screen that first looks like this:

enter image description here

Then looks like this (if you tap open):

enter image description here

You can see that there is a back button that will take you back, not to the app from which you originally tapped the install link, but to Safari. I assume this is because we used a wrapped URL that did a 302 redirect to the app store, which mean that UIApplication.shared.open didn't realize it was a link to the app store and used Safari instead to resolve the link, which then took you to the App Store.

However, upon further investigation, there is clearly some kind of API call that will present a modal UIViewController that itself hosts the iOS App Store, and comes with a "Done" button to tap when you are finished.

You can see this below in the animated gif I created from an ad unit in a popular Weather app; in this video I have tapped on the "War Robots" install ad.

enter image description here

What API is the ad unit in the above video calling to present the iOS App Store in a modal UIViewController with a done button, instead of backgrounding the entire app and taking you fully to Safari and then to the App Store app? Here is what I am describing:

enter image description here

Upvotes: 0

Views: 252

Answers (1)

mediumhotcoffee
mediumhotcoffee

Reputation: 11

You can use SKStoreProductViewController.

It has been available since iOS 6 and it's the recommended way for taking a user to an App Store listing. You can also check this answer: How to link to apps on the app store.

Upvotes: 0

Related Questions