Testing localized in-app purchases

前端 未结 2 1109
遇见更好的自我
遇见更好的自我 2020-12-19 17:38

Running the app with the Scheme set to another language does not affect the SKProduct received from iTunes in testing. The only way I’ve found to affect change is to create

相关标签:
2条回答
  • 2020-12-19 17:40

    You are right: change Scheme's language will not affect the SKProduct.

    Go to change "App Store's Country/Region", then you can see the changes, how to change:

    https://apple.stackexchange.com/a/89186/283550

    Also refer to my answer in another post:

    https://stackoverflow.com/a/52418249/3260008

    0 讨论(0)
  • 2020-12-19 17:53

    Here is what I've been able to figure out, to the best of my ability. This is pretty tricky to test... sometimes needed to run the app 3 or 4 times and load the list of SKProducts over and over again before a localizedDescription would change to the language I was trying to test.

    I was trying to figure out if these are controlled by logging in with a Sandbox Test User that was created with an iTunes Store set to another country? Or by the iPhone's language chosen in Settings?

    SKProduct's .price, SKProduct's .localizedTitle, SKProduct's .localizedDescription, and the system pop up "Do you want to buy one ____ for ___?" / "Cancel" / "Buy"

    It seems to me that to properly get all the values for each language, you need BOTH to have changed the phone's system language AND to log in with a Sandbox Test User created for the country's App Store.

    To populate my button text, I did the following:

    let formatter = NSNumberFormatter()
    formatter.numberStyle = .CurrencyStyle
    formatter.locale = productName.priceLocale
    let cost = formatter.stringFromNumber(productName.price)!
    labelForButton = "\(cost) " + productName.localizedDescription
    
    0 讨论(0)
提交回复
热议问题