我有一個iOS應用程序,我剛剛提交了更新。應用程序(模擬器和我的4S)的開發版本從未崩潰,它工作得很好。該應用程序今天和IAP一樣得到了批准,但今天早上我意識到iAP並未「被清除」購買。我剛剛清理它購買,但該應用程序仍然崩潰。在iPhone給出了錯誤(運行App Store中的版本)給出了錯誤:在應用程序購買崩潰應用程序
<Error>: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
這裏是發生這種情況的代碼:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:
(SKProductsResponse *)response
{
NSArray *myProduct = response.products;
//this line is where the error occurs
noAdProduct = [myProduct objectAtIndex:0];
if (![[[NSUserDefaults standardUserDefaults] objectForKey:@"the id here"] boolValue]) {
adCell.detailTextLabel.text = [NSString stringWithFormat:@"$%@", noAdProduct.price];
adCell.userInteractionEnabled = YES;
adCell.accessoryType = UITableViewCellAccessoryNone;
adCell.accessoryView = nil;
[self.tableView reloadData];
}
}
這種情況發生,同時要求提供產品的列表,這顯然會在模擬器中返回產品,但不會在應用程序中返回。我剛剛添加了一個防範措施,但我需要再次將它提交給App Store。
有誰知道爲什麼iAP沒有顯示爲App Store版本?我是否需要等待「清空出售」選項才能訪問Apple的服務器?謝謝!
您是否登錄過'myProduc'?您是否註冊了您的應用內購買標識符? – NSAddict
該系統在模擬器上完美工作,但在手機上,陣列「response.products」爲空。當我在ITC中檢查「清除購買」並且蘋果服務器開始確認時,是否有延遲?另外,你在第二個問題中意味着什麼。在ITC中,它表示「已批准」iAP –
'[[SKProductsRequest alloc] initWithProductIdentifiers:upgradeIdentifiers];'您是否在那裏註冊您的應用程序購買? – NSAddict