- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在使用 Xcode v7.2 和 Obj-c。我正在向现有的 iOS 应用程序添加不同的语言。主要问题是 SKProduct localizedTitle(iTC 上的显示名称)总是以英文返回。 我可以显示经过适当本地化和格式设置的价格。我已经在 SO 上准备了许多类似的问题并尝试了他们的解决方案,但它似乎对我不起作用(例如: this 和 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];
}
}
创建新的 Xcode 方案,以便将测试设备的Language、Location 和Region 设置为所需的国家/地区
结果:我正确地看到了该国家/地区的 IAP 价格,但我没有看到正确本地化的按钮标题。按钮的标题仍然是英文。我设置的每种语言都会出现这种情况。
任何人都可以发现我在这里做错了什么吗?我是否错误地假设 SKProduct.localizedTitle 不返回该语言(App Store)的 iTC 显示名称?任何帮助将不胜感激,谢谢。
最佳答案
localizedDescription and localizedTitle return localized information whose language is based on the current iTunes Store rather than the current device language setting.
关于ios - SKProduct localizedTitle 总是英文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34483032/
我的应用程序中有应用程序内购买。我正在使用日本商店中的测试帐户测试 Japanase 语言设备。我在应用购买标题和描述中同时使用英语和日语。 无论我做什么,SKProduct 的 localizedT
我正在实现应用程序内商店并成功地从应用程序商店获取 SKProducts。 SKProducts 中的价格信息和描述都很好,但我所有的 localizedTitles 都是零。在 iTunes Con
我正在使用 Xcode v7.2 和 Obj-c。我正在向现有的 iOS 应用程序添加不同的语言。主要问题是 SKProduct localizedTitle(iTC 上的显示名称)总是以英文返回。
我正在使用 Apples Photos Framework 将 PHAssetCollections 加载到我的应用程序中。我总是得到智能收藏的英文名称。例如,我得到的是“收藏夹”而不是“收藏夹”(瑞
我想在我的应用程序中更改专辑名称。 if ([collection canPerformEditOperation:PHCollectionEditOperationRename] == YES)
我有 1 个 IAP 已提交给该应用以供审核。 当我检索可用的产品列表(此时只有 1 个)时,我确实看到了提交的 IAP 产品。到目前为止一切顺利。 现在归结为显示产品(在 UITableView 中
我目前正在实现应用内购买机制,但有三件事我没有完全理解。 在下面的 tableView 中,我使用单例类从应用 Storm 中检索产品,有三件事我不确定它们到底做了什么...... 什么是 as! S
我是一名优秀的程序员,十分优秀!