Trying to build a tvOS app and one of the use cases I have is to be able to link off and open another app in the Apple TV App Store directly on a button click. Can someone p
This is the solution for Swift 4:
Replace XXXXXXX
with your app id.
With this solution its possible to create an appstore link for a not yet released app because only the app id (known from appstore connect) is needed.
guard let tvOSAppStoreUrl = URL(string: "com.apple.TVAppStore://itunes.apple.com/app/idXXXXXXX?mt=8") else {
return
}
UIApplication.shared.open(url, options: [:], completionHandler: nil)
I have figured this out by examining the device console output. The trick is to use the com.apple.TVAppStore
scheme instead of itms-apps
. Example (Swiss App Store):
com.apple.TVAppStore://itunes.apple.com/ch/app/youtube/id544007664?mt=8
In fact, the https
scheme is also working, but it's then transformed into com.apple.TVAppStore
anyway.
Yes, it works ! Just use the link provided by Apple's link maker. For example:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://geo.itunes.apple.com/fr/app/math-champions-jeux-calcul/id561572290?mt=8"]]
Do not modify the link by removing the language or the name of the app like you can on iOS.
Should be possible using SKStoreProductViewController
in StoreKit.
But apparently, that too is _TVOS_PROHIBITED
.
SKStoreProductViewController Class Reference
You can use the URL you get from iTunes. For example:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://geo.itunes.apple.com/fr/app/math-champions-jeux-calcul/id561572290?mt=8"]]
Similar to what the above answers said. But, in order for this to work, your app must be set up as a universal purchase for iOS and tvOS, which is very easy to set up: Universal Purchase of iOS and tvOS Apps.
Unfortunately this is not possible with the current tvOS.
On iOS, as advised by Apple in QA1629, we would do:
NSString *iTunesLink = @"https://itunes.apple.com/us/app/apple-store/id375380948?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
The above request goes through Safari which does not exist on tvOS. Therefore, it won't work.
However, Custom URL Schemes are supported on tvOS which might help at least a bit.