0
我允許用戶一次購買多個耗材(同一類型)。我已經實現了下面的代碼:一次購買多個耗材
- (void)purchaseMyProduct:(NSArray *) products {
if ([SKPaymentQueue canMakePayments]) {
for(SKProduct *product in products) {
SKPayment *payment = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
}
else {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:
@"Purchases are disabled in your device" message:nil delegate:
self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alertView show];
}
}
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
UIAlertView *alertView ;
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
NSLog(@"Purchasing");
break;
case SKPaymentTransactionStatePurchased:
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
[self
break;
default:
break;
}
}
}
但問題是,每個單獨的消耗品條目顯示一個單獨的提示,要求用戶確認購買。
IAP是否有可能一次購買同一類型的多種消耗品,並向用戶提供一個提示?
我曾經想過的一種邏輯是在商店中爲多種消耗品創建單獨的產品,例如,一個產品爲兩個,另一個爲三個消耗品。
請幫忙。
謝謝,