I have an in-app purchase for my app that costs £1.99. I display this price using a pop-up, however, when the device is not connected to the internet it cannot retrieve the price of my IAP, so it shows up blank.
The price of my IAP will always be £1.99 GBP. How do I display this IAP tier for other countries when the device is not connected to the internet?
This is how I currently get the price of my IAP:
_products = nil;
[[AppIAPHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) {
if (success) {
_products = products;
SKProduct * product = _products[0];
[[AppIAPHelper sharedInstance] productPurchased:product.productIdentifier];
NSNumberFormatter *_priceFormatter = [[NSNumberFormatter alloc] init];
[_priceFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[_priceFormatter setLocale:product.priceLocale];
priceString = [_priceFormatter stringFromNumber:product.price];
NSLog(@"Price string: %@",priceString);
}
}];
I tried to test if priceString.count <= 0
(therefore device is not connected to the internet), and then execute:
NSDecimalNumber *amount = [NSDecimalNumber decimalNumberWithString:@"1.99"];
NSNumberFormatter *currencyFormat = [[NSNumberFormatter alloc] init];
NSLocale *locale = [NSLocale currentLocale];
[currencyFormat setNumberStyle:NSNumberFormatterCurrencyStyle];
[currencyFormat setLocale:locale];
NSLog(@"AmountSo with symbol: %@", [currencyFormat stringFromNumber:amount]);//Eg: $50.00
NSLog(@"Current Locale : %@", [locale localeIdentifier]);//Eg: en_US
But this only adds the local currecy symbol to amount
.
The problem is, I need to display the correct price tiers. For example, USD 1.99 converted to GBP is 1.27. But the IAP tiers are 1.99 USD and 1.49 GBP.
So basically - how do I show the App Store IAP price tiers for the user's local currecy without requesting the price of the SKProduct (if the user is not connected to the internet)? Thanks.