Just discovered this error after converting to iOS 13.1 Major issue since it causes the In-App Purchases view to crash. Have been using this In-App Apple code in our apps for five years and need help in sorting this out. Please reply if you have specific code solutions. Thanks!
- (void)viewDidLoad
{
[super viewDidLoad];
appCode = [Plis getSetting :@"AppCode"];
NSLog (@"InApp...VDL...appCode %@",appCode);
[self.tabBarController.tabBar setHidden:NO];
self.title = @"In-App Store";
[_detailView setDelegate:self];
[_detailView setDataSource:self];
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(reload) forControlEvents:UIControlEventValueChanged];
[self reload];
[self.detailView reloadData];
[self.refreshControl beginRefreshing];
_priceFormatter = [[NSNumberFormatter alloc] init];
[_priceFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[_priceFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Restore" style:UIBarButtonItemStylePlain target:self action:@selector(restoreTapped:)];
}
- (void)restoreTapped:(id)sender {
[[InAppProdID sharedInstance: appCode] restoreCompletedTransactions];
}
- (void)viewWillAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productPurchased:) name:IAPHelperProductPurchasedNotification object:nil];
[self.tabBarController.tabBar setHidden:NO];
}
- (void)viewWillDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)productPurchased:(NSNotification *)notification {
NSString * productIdentifier = notification.object;
[productArr enumerateObjectsUsingBlock:^(SKProduct * product, NSUInteger idx, BOOL *stop) {
if ([product.productIdentifier isEqualToString:productIdentifier]) {
self.productPurchased = productIdentifier;
[self unlockProduct];
[self.detailView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:idx inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
*stop = YES;
}
}];
}
- (void)reload {
productArr = nil;
[self.detailView reloadData];
[[InAppProdID sharedInstance: appCode] requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) {
if (success) {
productArr = products;
// HERE IS WHERE THE ERROR OCCURS!
[self.detailView reloadData];
}
[self.refreshControl endRefreshing];
}];
}