0
アプリのインポート購入を実装する必要があり、インボックス購入を初めて行っています。 私は自分の仕事を成し遂げるために必要なコードを取得していません。 私は以下のコードを入れました。 商品リストと返信のリクエストを追加する必要がありますか?iphoneアプリのインボックス購入
- (IBAction)Upgrade:(id)sender {
/* Store Kit Framework Payment Object with Specified Product Identifier -By Parth */
SKPayment *payment = [SKPayment paymentWithProductIdentifier:@"com.dev.InAppTry"];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
/* Updated Transactions Once Purchase is done. This is where we enable or disable some app */
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
NSLog(@"transactions : %@",transactions);
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
break;
case SKPaymentTransactionStatePurchased:
//[self downloadFromURL:[NSURL URLWithString:@"http://www.iphonedevnation.com/tutorials/ForestGreen.mp3"]];
flgCheck = 1;
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
lblremovead.enabled = YES;
adSwitch.enabled = YES;
//[[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"IN_APP_PURCHASE"];
break;
case SKPaymentTransactionStateRestored:
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:
if (transaction.error.code != SKErrorPaymentCancelled) {
NSLog(@"An error encounterd");
}
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
}
}
}
このリンクをチェックすると便利かもしれません http://stackoverflow.com/questions/6015744/iphone-in-app-purchase-app-registration-with-itunes-steps-for-testing – Devang