Opening the Apple TV App Store

一笑奈何 提交于 2019-11-28 19:46:48
kambala

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.

hufkens

Just tested this on tvOS:

if let appStoreURL = NSURL(string: "https://itunes.apple.com/us/app/wee-puzzles/id1035425291?mt=8") {
    UIApplication.sharedApplication().openURL(appStoreURL)
}

It works and opens the App Store page of your app on Apple TV. It's the same as iOS.

RaffAl

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.

JoriDor

Should be possible using SKStoreProductViewController in StoreKit. But apparently, that too is _TVOS_PROHIBITED.

SKStoreProductViewController Class Reference

nicolas leo

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.

Jenel Ejercito Myers

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.

This is the solution for Swift 4: Replace XXXXXXXwith 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 le tvOSAppStoreUrl = URL(string: "com.apple.TVAppStore://itunes.apple.com/app/idXXXXXXX?mt=8") else {
  return
}

UIApplication.shared.open(url, options: [:], completionHandler: nil)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!