I am using Xcode v7.2 and Obj-c. I am adding different languages ββto an existing iOS application. The main problem is that the localized SKProduct caption (display name on iTC) is always returned in English. I can show the price correctly localized and formatted . I have many similar problems on SO and have tried to solve them, but it doesn't seem to work for me (for example: this and this ).
Desired Result:
- Show 3 buttons to the user; Each button has a different name and price.
- Dynamically change the display name and IAP price, updating it only in iTC (so I donβt need to update the code every time I need a change).
- Because of # 2, I cannot hard write the name or price of the IAP to the button.
- Pull the localized name (display name on iTC) and the price from iTC to use it as a text label on the buttons.
Here is what I have already installed:
- Created test users on iTC and assigned them different stores:

- Install IAP on iTC and add languages ββand display names:

SKProduct capture code localizedTitle and prices 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 a new Xcode schema so that the test device Language , Location and Region is set to the desired country
- Exit the App Store on the Xcode simulator (from Settings ). When running tests in the simulator, I first see my application in the desired language, but the text on the buttons is in English. This is due to the fact that I have not yet changed the location in the App Store. I click the IAP purchase button and I am prompted to log in.
- I use my test user for this country. I stop the application and then run it again.
Result: I correctly see the IAP price for this country, but I do not see the button name being correctly localized. The button title is still in English. This happens with every language I have installed.
Can anyone determine what I am doing wrong here? Do I have the wrong assumption that SKProduct.localizedTitle does not return the iTC display name for this language (App Store)? Any help would be appreciated, thanks.
source share