我正在为我的ios应用程序开发应用内购买模式,但我遇到了返回NULL值的事务问题。 以下是更新事务的方法代码:
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchased:[self UnlockPurchase];
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:NSLog(@"Transaction Failed");
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
default:
NSLog(@"Value of the transaction : %@", transaction.transactionState);
break;
}
}
}
输出窗口(在Xcode中)显示的结果是:
Transaction Failed
Value of the transaction : (null)
答案 0 :(得分:0)
您无法使用“%@”打印,请尝试“%d”。如果状态碰巧有一个非零的值,那么你会发生崩溃而不是只打印“(null)”。