最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - Storekit, how to change and retrieve current user storefront - Stack Overflow

programmeradmin6浏览0评论

I've been struggling to work with the Storekit framework and specifically to find the current Storefront used by the user of the app.

Context : My app needs to behave differently depending on the country of the user.

For me relying on Locale.current.region?.identifier does not seem very reliable, the user can change it really easily.

I'm trying to use the Storekit framework like so :

if let storefront = await StoreKit.Storefront.current{
    return storefront.countryCode
}

As per Apple's Storekit documentation :

Use current to determine a customer's current storefront region and offer in-app products suitable for that region. You maintain your own list of product identifiers and the storefronts in which you make them available.

But I just can't find out what I need to change in my current configuration to get another country. The code keeps returning my original storefront (which is France)

I've tried login in with a sandbox user defined on another country. Changed all settings on my device to another country. Changed my Apple's account region as described here. Also tried to logout from everything.

The only thing that works is setting a local .storekit file as described here and changing the default storefront.

Is Xcode overriding the default storefront when building on debug or TestFlight? does anyone know how can I test different storefronts with sandbox users without the local storekit file ?

Thank you in advance.

I've been struggling to work with the Storekit framework and specifically to find the current Storefront used by the user of the app.

Context : My app needs to behave differently depending on the country of the user.

For me relying on Locale.current.region?.identifier does not seem very reliable, the user can change it really easily.

I'm trying to use the Storekit framework like so :

if let storefront = await StoreKit.Storefront.current{
    return storefront.countryCode
}

As per Apple's Storekit documentation :

Use current to determine a customer's current storefront region and offer in-app products suitable for that region. You maintain your own list of product identifiers and the storefronts in which you make them available.

But I just can't find out what I need to change in my current configuration to get another country. The code keeps returning my original storefront (which is France)

I've tried login in with a sandbox user defined on another country. Changed all settings on my device to another country. Changed my Apple's account region as described here. Also tried to logout from everything.

The only thing that works is setting a local .storekit file as described here and changing the default storefront.

Is Xcode overriding the default storefront when building on debug or TestFlight? does anyone know how can I test different storefronts with sandbox users without the local storekit file ?

Thank you in advance.

Share Improve this question asked Mar 25 at 17:12 Michael PirotteMichael Pirotte 2724 silver badges13 bronze badges 6
  • During testing you can use the local StoreKit file. TestFlight uses real Apple Store accounts, not sandbox accounts, so during TestFlight testing you will need to log in to the App Store on your device with an Apple ID that is set to the desired country. – Paulw11 Commented Mar 25 at 19:28
  • Hello, thank you for your reply, unfortunately I've tried that, my developper account is now in china region and when I download an app with Testflight it still returns a French storefront for some reason. – Michael Pirotte Commented Mar 26 at 9:47
  • Did you use this process support.apple/en-au/118283 ? If not then you haven't changed your App Store region. – Paulw11 Commented Mar 26 at 11:10
  • Yes that's exactly what I did ad stated in my original post. – Michael Pirotte Commented Mar 26 at 13:03
  • Did you then log out of your store account on your device, restart the device and login in again? – Paulw11 Commented Mar 26 at 19:39
 |  Show 1 more comment

1 Answer 1

Reset to default 0

Changed all settings on my device to another country. Changed my Apple's account region as described here.

If you want to change the App Store country or region for your Sandbox Apple account, you must follow the instructions in the Edit country or region on the App Store section of this page , which is the documentation for setting up your Sandbox account, instead of following the instructions above.

发布评论

评论列表(0)

  1. 暂无评论