IAP に MKStoreKit を使用しています。すべてのタスクを簡単に実行できます (シンプルで使いやすい) が、productid で現地価格を取得するのに苦労している
mkstorekit で現地価格を取得することは可能ですか?
また、商品の現地価格を表示する場合、審査に問題はありませんか?
IAP に MKStoreKit を使用しています。すべてのタスクを簡単に実行できます (シンプルで使いやすい) が、productid で現地価格を取得するのに苦労している
mkstorekit で現地価格を取得することは可能ですか?
また、商品の現地価格を表示する場合、審査に問題はありませんか?
//...
self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:_productIdentifiers];
self.productsRequest.delegate = self;
[self.productsRequest start];
//...
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
NSLog(@"Loaded list of products...");
NSArray * skProducts = response.products;
for (SKProduct *product in skProducts) {
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:product.priceLocale];
NSString *formattedPrice = [numberFormatter stringFromNumber:product.price];
//Use formattedPrice
}
}
編集
使用している場合: https://github.com/MugunthKumar/MKStoreKit
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleSKProductsAvailableNotification:) name:kMKStoreKitProductsAvailableNotification object:nil];
[[MKStoreKit sharedKit] startProductRequest];
//...
- (void)handleSKProductsAvailableNotification:(NSNotification *)note
{
NSArray * skProducts = [MKStoreKit sharedKit].availableProducts;
for (SKProduct *product in skProducts) {
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:product.priceLocale];
NSString *formattedPrice = [numberFormatter stringFromNumber:product.price];
//Use formattedPrice
}
}