iPhone App:在App Purchase中购买
问题描述:
在App App中购买:什么时候是SKPaymentTransactionStateRestored:叫?iPhone App:在App Purchase中购买
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStateRestored:
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
}
}
}
如何从苹果得到确认,该应用程序购买成功意味着我想打印NSlog中的信息。
我应该怎么写是什么?
答
就我而言,仅当Apple响应updatedTransactions状态为SKPaymentTransactionStateRestored
或SKPaymentTransactionStatePurchased
时才成功购买transactions
。
答
当方法:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
for (SKPaymentTransaction * transaction in transactions) {
//process the transaction
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchased:
[self completeTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:
[self failedTransaction:transaction];
break;
case SKPaymentTransactionStateRestored:
[self restoreTransaction:transaction];
break;
default:
break;
}
}
}
被称为这意味着你已经与苹果完成你的交易,你处理三种情况:
SKPaymentTransactionStatePurchased:这意味着你的产品是买的。
SKPaymentTransactionStateFailed:你的产品不能买。
SKPaymentTransactionStatePurchased:这是你的问题。只要您的SKPaymentTransactionObserver处于活动状态,交易是持续的,这意味着如果您的客户打算购买您的产品,但在交付产品时发生了错误(服务器错误或其他),那么当应用程序再次启动时,事务将返回到此方法完成购买。
我希望信息帮助。
手表诉讼^ _^ – FreeAsInBeer 2012-01-11 15:14:32
Prerak你好你怎么样? – 2012-02-17 10:24:02