我想找出用户的 App Store 位置。这意味着他们在美国、澳大利亚 (AUD) 商店。使用了以下代码。
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
Books = response.products;
if ([SKPaymentQueue canMakePayments] && [response.products count]>0) {
}
for (SKProduct *book in Books) {
NSLocale *locat=[NSLocale currentLocale];
NSString *strlocate=[locat objectForKey:NSLocaleCountryCode];
NSLog(@"\n\n\n Device country== %@ \n\n\n",strlocate);
NSLocale* storeLocale = book.priceLocale;
NSString *storeCountry = (NSString*)CFLocaleGetValue((CFLocaleRef)storeLocale, kCFLocaleCountryCode);
NSLog(@"\n\n\n store country== %@ \n\n\n",storeCountry);
}
}
如果图书等级是 0.99 美元 0.99 日元 85 美元(基于应用商店价格矩阵表),我也希望如此。
我在模拟器中测试过。我在系统中的 iTunes、appstore 和 safari 应用程序中更改了国家/地区名称。但我只得到美国国家代码。
编辑: 设置->通用->国际化->区域格式->国家
我在设备中进行了测试:设备国家/地区仅发生了变化。 store country 显示美国国家代码和价格。我想在开始购买应用程序之前存储国家代码。
一次根据货币波动更改价格多少天? 它是否提供任何 api/查询已知/更新的波动价格?
我的 inapp 操作上了一节课。在应用程序操作之前,我想向用户显示本地价格,同样的价格效果反射(reflect)在应用程序操作中。
我显示了从我的服务器获取的免费和付费书籍列表。因为我显示了每件商品的价格。这些商品价格在处理应用程序商店时会显示美元价格。如果 Appstore 显示的价格也是我想显示的。所以我想从我的服务器发送国家代码到我的服务器响应那个国家相关的价格表和货币符号..
最佳答案
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:prodcutIdentifier];
productsRequest.delegate = self;
// This will trigger the SKProductsRequestDelegate callbacks
[productsRequest start];
这将调用您的委托(delegate)函数。完成上述操作后,它最终会自动调用下面提到的函数。这是发送的应用程序商店请求将被最终确定的地方。
(void)requestDidFinish:(SKRequest *)request
{
SKProduct *book = [Books objectAtIndex:0];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:book.priceLocale];
NSLocale* storeLocale = book.priceLocale;
NSString *storeCountry = (NSString*)CFLocaleGetValue((CFLocaleRef)storeLocale, kCFLocaleCountryCode);
}
根据您的兴趣提供区域设置和国家详细信息。
关于iphone - 如何在 iOS 中获取应用内购买的区域设置货币价格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14453910/