transactionReceipt para compra no aplicativo foi preterido no iOS 7. Com que posso substituí-lo?
No iOS 7, noSKPaymentTransaction classe, a propriedadetransactionReceipt
:
// Only valid if state is SKPaymentTransactionStatePurchased.
@property(nonatomic, readonly) NSData *transactionReceipt
…édescontinuada. Mas, no meu código, eu criei uma classe InAppPurchase, e no meu método para controlar como é o método de compra, estou usando o método delegate no meu código e é como:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
// code and bla bla bla
[self initPurchase];
NSLog(@"PASO 1");
break;
case SKPaymentTransactionStatePurchased:
// this is successfully purchased!
purchased = TRUE;
NSLog(@"PASO 2");
[self isPurchased];
NSLog(@"purchased %s", purchased? "true" : "false");
// and return the transaction data
if ([delegate respondsToSelector:@selector(successfulPurchase:restored:identifier:receipt:)])
[delegate successfulPurchase:self restored:NO identifier:transaction.payment.productIdentifier receipt:transaction.transactionReceipt];
// and more code bla bla bla
break;
case SKPaymentTransactionStateRestored:
// and more code bla bla bla
[self restorePurchase];
NSLog(@"PASO 3");
break;
case SKPaymentTransactionStateFailed:
// and more code bla bla bla
[self failedNotification];
NSLog(@"PASO 4");
break;
//------------------------------------------//
// THANKS GUYS //
// GRETTINGS FROM BOLIVIA //
// ROCK ON!!!! n_n' //
//------------------------------------------//
}
}
}