kay*_*a08 4 country objective-c region app-store ios
有没有办法检查它?我有一个应用程序 URL,如果用户有英国应用商店,我不想打开它。不幸的是,此应用程序在许多国家/地区都可用,因此当我在链接上添加“gb”时,它会被重定向到用户的本地区域。
对于 iOS 13+,检查SKStoreFront类。它有一个countryCode返回属于用户当前 App Store 区域的国家/地区代码。
迅速
if let storefront = SKPaymentQueue.default().storefront {
print(storefront.countryCode) // Returns an Alpha-3 country code (USA, GBR etc.)
}
Run Code Online (Sandbox Code Playgroud)
对象C
[SKPaymentQueue defaultQueue].storefront.countryCode; // Returns an Alpha-3 country code (USA, GBR etc.)
Run Code Online (Sandbox Code Playgroud)
您应该能够SKStoreFront通过将 StoreKit 框架添加到您的项目来访问该实例,即使您的应用程序不提供任何购买。
有关更多信息,请查看:https : //developer.apple.com/documentation/storekit/skstorefront