我正在IAP第一次工作。我已經在沙盒環境中創建了測試用戶並且工作得很好。我可以看到我的購買併購買它(當然我添加了StoreKit框架),但問題是:當我上傳更新與IAP到AppStore - 主持人已拒絕我的應用程序,這是一個原因:在主持人審查我的應用程序時,應用程序購買不工作
我們發現雖然您已爲應用程序提交In App Purchase產品,但In App Purchase功能不在您的二進制文件中。 (有沒有在屏幕上購買一些東西,空的空間來代替)
如果你想在你的應用程序中使用In App Purchase,你需要上傳一個新的二進制文件它包含了In App Purchase API以使用戶可以進行購買
我只是不明白它有多可能?爲什麼當我測試IAP時 - 它的工作正常,但當主持人做這件事時它不起作用?所有IAP都有「已清算待售」和「等待審覈」狀態
現在,如果我上傳應用程序到商店,IAP的工作原理是什麼?或者,也許我需要做一些額外的行動之前?
這裏是我的代碼:在應用
- (void)viewDidLoad
{
[super viewDidLoad];
_iapArray = [[NSMutableArray alloc] init];
iap1 = @"com.mypurchase.addcoins1";
[self paymentCheck];
}
- (void)viewDidDisappear:(BOOL)animated
{
[[SKPaymentQueue defaultQueue] removeTransactionObserver:self];
}
- (void)paymentCheck{
if([SKPaymentQueue canMakePayments]){
NSLog(@"User can make payments");
SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObjects:iap1, nil]];
productsRequest.delegate = self;
[productsRequest start];
}
else{
NSLog(@"User cannot make payments due to parental controls");
//this is called the user cannot make payments, most likely due to parental controls
}
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
SKProduct *validProduct = nil;
int count = [response.products count];
if(count > 0){
_iapArray = response.products;
indicator.hidden = YES;
[self.tableView reloadData];
}
else if(!validProduct){
NSLog(@"No products available");
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Error"
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[myAlertView show];
//this is called if your product id is not valid, this shouldn't be called unless that happens.
}
}
- (IBAction)purchase:(SKProduct *)product{
SKPayment *payment = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
for(SKPaymentTransaction *transaction in transactions){
switch (transaction.transactionState){
case SKPaymentTransactionStatePurchasing: NSLog(@"Transaction state -> Purchasing");
//called when the user is in the process of purchasing, do not add any of your own code here.
break;
case SKPaymentTransactionStatePurchased:
//this is called when the user has successfully purchased the package (Cha-Ching!)
// [self doRemoveAds]; //you can add your code for what you want to happen when the user buys the purchase here, for this tutorial we use removing ads
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
NSLog(@"Transaction state -> Purchased - %@", transaction.payment.productIdentifier);
if ([transaction.payment.productIdentifier isEqualToString:iap1]) {
[self addCoins:5];
}
break;
case SKPaymentTransactionStateRestored:
NSLog(@"Transaction state -> Restored");
//add the same code as you did from SKPaymentTransactionStatePurchased here
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:
//called when the transaction does not finnish
if(transaction.error.code != SKErrorPaymentCancelled){
NSLog(@"Transaction state -> Cancelled");
//the user cancelled the payment ;(
}
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
}
}
}
我懷疑審閱者不知道如何在您的應用中進行購買。應用內購買屏幕截圖是否清楚地顯示瞭如何訪問您的商店?是否清楚如何在您的應用中進行購買? – singingAtom 2014-10-04 15:20:12
檢查您的iTunes連接中的應用程序購買狀態?它是否準備好銷售狀態?查看產品ID。 – Manthan 2014-10-06 10:08:26
不,他們知道如何在我的應用程序中進行購買,但是當他們用IAP打開視圖 - 它們不會出現,只是錯誤 - 我猜 - (void)productsRequest:(SKProductsRequest *)請求didReceiveResponse方法返回無效產品: (當我上傳我的版本進行審查時,IAP有「等待審覈」狀態 - 是否? – user2154220 2014-10-07 07:26:26