I am using MKStoreKit for IAP. I can get all the task done easily (it's simple and easy to use) but m stuck to get the local price by productid
Is it possible to get the local price in mkstorekit ?
And if i will display local price for product will it create any problem in review ?
//...
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
}
}
EDIT
If you are using: 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
}
}
MKStoreKit has built in ability to display product titles along with their localized price.
It has function to format the product name with their localized name, description and currency.
- (NSMutableArray*) purchasableObjectsDescription;
For more details you can refer: MKStoreKit
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.