fsb*_*fsb 7 xcode objective-c in-app-purchase ios skproduct
我正在使用Xcode v7.2和Obj-c.我正在为现有的iOS应用添加不同的语言.主要问题是SKProduct的localizedTitle(iTC上的显示名称)总是以英文显示. 我可以正确地显示价格本地化和格式化.我已经准备好了许多关于SO的类似问题,并尝试过他们的解决方案,但它似乎对我不起作用(例如:this and this).
期望的结果:
这是我已经设置的内容:


从iTC获取SKProduct localizedTitle和价格的代码
[[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];
}
}
Run Code Online (Sandbox Code Playgroud)创建新的Xcode方案,以便将测试设备语言,位置和区域设置为所需的国家/地区
结果: 我正确地看到了该国家/地区的IAP价格,但我没有看到该按钮的标题是否已正确本地化.按钮的标题仍为英文.我设置的每种语言都会发生这种情况.
谁能发现我在这里做错了什么?我是否错误地认为SKProduct.localizedTitle没有返回该语言的iTC显示名称(App Store)?任何帮助将不胜感激,谢谢.
| 归档时间: |
|
| 查看次数: |
1035 次 |
| 最近记录: |