I'm using Xcode v7.2 and Obj-c. I'm adding different languages to an existing iOS app. The main problem is that the SKProduct localizedTitle (Display Name on iTC) always comes back in English. I can show the price properly localized and formatted. I have ready many similar issues on SO and have tried their solutions but it doesn't seem to be working for me (for example: this and this).
Desired outcome:
Here's what I have setup already:
Code to grab SKProduct localizedTitle and price from iTC
[[FirstDrawIAPHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) {
if (success) {
storeProducts = products;
SKProduct *product = (SKProduct *)storeProducts;
//Format price
priceFormatter = [[NSNumberFormatter alloc] init];
[priceFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[priceFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
//Iterate thru the buttons using tipButton Outlet Collection
for (int i = 0; i < [self.tipButton count]; i++) {
UIButton *button = [[UIButton alloc] init];
button = self.tipButton[i];
//product = storeProducts[i];
product = products[i];
//Set the price locale
[priceFormatter setLocale:product.priceLocale];
//Localize the button title and append the price
NSString *btnTxt = [product.localizedTitle stringByAppendingString:@" "];
NSString *price = [priceFormatter stringFromNumber:product.price];
NSString *newBtn = [btnTxt stringByAppendingString:price];
NSLog(@"\nID: %@, Price: %@, Button: %@",[product localizedTitle], price, btnTxt);
//Set button title
[button setTitle:newBtn forState:UIControlStateNormal];
}
}
Create new Xcode scheme so the test device Language, Location and Region are set to the desired country
Result: I correctly see the IAP price for that country but I don't see the button's title correctly localized. The button's title is still in English. This happens with each language I've setup.
Can anyone spot what I'm doing wrong here? Do I have the wrong assumption that SKProduct.localizedTitle does not return the iTC Display Name for that language (App Store)? Any help would be appreciated, thanks.
Based on In-App Purchase FAQ
localizedDescription and localizedTitle return localized information whose language is based on the current iTunes Store rather than the current device language setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With