在开发iPhone应用程序时,我在restoreCompletedTransactions方面遇到了一些麻烦.在沙箱环境中工作时,会出现下面列出的所有问题.该应用尚未销售.它是在模拟器5.0和5.1中运行的Xcode 4.3.2开发的.我得到的问题是:
此时我完全卡住了.我的应用程序依赖于AppStore来返回非耗材的信息,因为我们没有将这些数据保存在我们自己的服务器中.但我们需要确保AppStoreKit返回包含所有购买项目的列表.不只是一些.
这是我用来测试restoreCompletedTransactions的相关代码:
- (void) paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
NSLog(@"updatedTransactions started. -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ");
NSLog(@"Number of transactions received: %d.", [transactions count]);
int count = 0;
for (SKPaymentTransaction *trans in transactions)
{
NSLog(@"Data for transaction %d: ", ++count);
NSString *transId = [trans transactionIdentifier];
switch ([trans transactionState])
{
case SKPaymentTransactionStatePurchasing:
NSLog(@"Purchasing transaction: %@", transId);
if (transId == nil)
{
NSLog(@" Original transaction Id: %@", [[trans originalTransaction] transactionIdentifier]);
}
NSLog(@" No action taken in update");
break;
case SKPaymentTransactionStateFailed: …Run Code Online (Sandbox Code Playgroud) 是否可以使用沙盒删除 AppStore 中非消耗品的购买?'restoreCompletedTransactions' 的响应在第一个非消耗品的购买发生后是不同的。出于测试目的,删除这些购买是非常有价值的,看看不同的函数在购买发生后如何返回不同的值。或者。 . 是我添加越来越多的非消耗品进行测试的唯一选择,即便如此,'restoreCompletedTransactions' 的行为也不会完美吗?