1

Apple 已经批准了我们的第一个具有应用内购买功能的应用 - 但是当用户点击“升级”按钮时,应用会突然挂起,然后崩溃。通过使用 XCode 管理器中的控制台功能,我能够获得以下报告:

Sep 18 15:12:48 iPad MyApp[53107] <Error>: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
    *** First throw call stack:
    (0x316f92a3 0x3958497f 0x31643e8d 0x54b23 0x335ec0c5 0x335ec077 0x335ec055 0x335eb90b 0x335ebe01 0x335145f1 0x33501801 0x3350111b 0x351f35a3 0x351f31d3 0x316ce173 0x316ce117 0x316ccf99 0x3163febd 0x3163fd49 0x351f22eb 0x33555301 0x4b81f 0x399bbb20)
Sep 18 15:12:48 iPad ReportCrash[53109] <Notice>: Formulating crash report for process MyApp[53107]
Sep 18 15:12:48 iPad com.apple.launchd[1] (UIKitApplication:com.mycompany.MyApp[0x716c][53107]) <Warning>: (UIKitApplication:com.mycompany.MyApp[0x716c]) Job appears to have crashed: Abort trap: 6
Sep 18 15:12:48 iPad ReportCrash[53109] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Sep 18 15:12:48 iPad backboardd[26] <Warning>: Application 'UIKitApplication:com.mycompany.MyApp[0x716c]' exited abnormally with signal 6: Abort trap: 6
Sep 18 15:12:48 iPad ReportCrash[53109] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/MyApp_2013-09-18-151248_iPad.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0

当我在我的设备上运行该应用程序时不会发生这种情况,并且在 Apple 审查它时它必须已经工作,否则他们不会批准它出售。

我猜我的 products 数组为空,并且在尝试购买_products[0](唯一可用的)时它崩溃了。

更多信息:我在添加应用内购买时 遵循了 Ray Wenderlich 的教程:

[[AppStoreHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) {
    if (success) {
        _products = products;
    }
    [refreshControl endRefreshing];
}];

总结一下:为什么它只在测试模式下工作?

提前致谢!

4

1 回答 1

2

现在可以了。我猜苹果的服务器需要一些时间来处理购买......

于 2013-09-19T06:17:08.713 回答