我有一个很奇怪但很严重的问题,我找不到任何有类似情况的人。
我有一个应用程序,其中包含三个应用程序内购买选项。在内部,paymentQueue:updatedTransactions:
方法,我在成功购买后向服务器发送一个调用并将其记录在我的数据库中。所以我知道我的应用程序实时每个 IAP 的确切数量。
然而,当登录iTunesConnect并查看销售额时,我发现应用内购买完成的数量要少得多。例如,三天前,我的数据库记录了150 次应用购买。然而 iTunesConenect 仅显示同一天总共完成的30笔交易。
我不知道为什么会这样。
我不验证收据 - 我选择不验证收据,因为我真的不在乎少数人是否越狱他们的手机并免费获得 IAP。所以我想这可能是问题所在,但我真的怀疑使用我的应用程序的 150 个用户中有 120 个使用的是越狱手机。
所以我想知道:iTunesConnect IAP 报告是否有延迟?或者它在我的代码中?(代码如下)
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
NSLog(@"Transaction: %@\n", transaction.payment.productIdentifier);
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
NSLog(@"Processing purchase");
[_purchasingActivityView setTitle:@"Processing"];
// show wait view here
//statusLabel.text = @"Processing...";
break;
case SKPaymentTransactionStatePurchased:
//TODO-> Log analytics
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
NSLog(@"Finished purchase: %@\n", transaction.payment.productIdentifier);
//All Filters were purchased
if([transaction.payment.productIdentifier isEqualToString:kInAppPurchaseFilterPackALLProductId]) {
if ([[ACSimpleKeychain defaultKeychain] storeUsername:@"iapALL"
password:nil
identifier:transaction.transactionIdentifier
forService:@"myService"]) {
[Logger log:[NSString stringWithFormat:@"Stored transaction credentials for fall: %@", transaction.transactionIdentifier]];
[[WebCallManager sharedManager] sendPurchaseNotice:@"ALL" withDeviceId:[OpenUDID value] withDelegate:nil];
}
else {
[Logger log:[NSString stringWithFormat:@"Error storing transaction credentials for fpone & fptwo purchase: %@", transaction.transactionIdentifier]];
}
}
//Filter Pack ONE was purchased
else if([transaction.payment.productIdentifier isEqualToString:kInAppPurchaseFilterPackONEProductId]) {
if ([[ACSimpleKeychain defaultKeychain] storeUsername:@"iapONE"
password:nil
identifier:transaction.transactionIdentifier
forService:@"myService"]) {
[Logger log:[NSString stringWithFormat:@"Stored transaction credentials for fpone purchase: %@", transaction.transactionIdentifier]];
[[WebCallManager sharedManager] sendPurchaseNotice:@"ONE" withDeviceId:[OpenUDID value] withDelegate:nil];
}
else {
[Logger log:[NSString stringWithFormat:@"Error storing transaction credentials for fpone purchase: %@", transaction.transactionIdentifier]];
}
}
//Filter Pack TWO was purchased
else if([transaction.payment.productIdentifier isEqualToString:kInAppPurchaseFilterPackTWOProductId]) {
if ([[ACSimpleKeychain defaultKeychain] storeUsername:@"iapTWO"
password:nil
identifier:transaction.transactionIdentifier
forService:@"myService"]) {
[Logger log:[NSString stringWithFormat:@"Stored transaction credentials for fptwo purchase: %@", transaction.transactionIdentifier]];
[[WebCallManager sharedManager] sendPurchaseNotice:@"TWO" withDeviceId:[OpenUDID value] withDelegate:nil];
}
else {
[Logger log:[NSString stringWithFormat:@"Error storing transaction credentials for fptwo purchase: %@", transaction.transactionIdentifier]];
}
}
[_purchasingActivityView dismissWithClickedButtonIndex:0 animated:YES];
break;
case SKPaymentTransactionStateRestored:
if(_purchasingActivityView) {
[_purchasingActivityView dismissWithClickedButtonIndex:-1 animated:YES];
}
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
// remove wait view here
NSLog(@"Transation restored\n");
break;
case SKPaymentTransactionStateFailed:
if (transaction.error.code != SKErrorPaymentCancelled) {
NSLog(@"Error payment cancelled");
}
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
// remove wait view here
[_purchasingActivityView dismissWithClickedButtonIndex:-1 animated:YES];
NSLog(@"Purchase Error: %@\n", [[transaction error] description]);
break;
default:
break;
}
}
}
从用户的角度来看,交易似乎完美无缺。
任何帮助/建议将不胜感激。这让我完全困惑。谢谢!
编辑:我还应该提到我有三个 IAP 产品,根据我的数据库记录,所有这些产品都被多次购买。然而,ITC 只显示其中两个曾经被购买过。