我正在尝试在应用商店中为我的新版本应用实施 IAP。这是我所做的一切:
- 在 iTunes 连接中制作了新版本,状态 = 准备上传。
- 在“管理应用内购买”中添加新产品
- 创建测试用户帐户。
实现流动代码:
-(IBAction)audio{ //test the restriction if ([SKPaymentQueue canMakePayments]){ SKProductsRequest *skproductrequiste = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"AudioPlayer"]]; skproductrequiste.delegate = self; [skproductrequiste start]; } //after purshsing youcan show /* detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"show_pro"]; detailViewController.product = @"audio"; [self.navigationController pushViewController:detailViewController animated:YES]; */ } -(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{ SKProduct *validproducte = nil; int count = [response.products count]; if (count >0) { validproducte = [response.products objectAtIndex:0]; SKPayment *pay = [SKPayment paymentWithProductIdentifier:@"AudioPlayer"]; [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; [[SKPaymentQueue defaultQueue]addPayment:pay]; } else{NSLog(@"no product");} } -(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{ for(SKPaymentTransaction *transiction in transactions){ switch (transiction.transactionState) { case SKPaymentTransactionStatePurchasing: break; case SKPaymentTransactionStatePurchased: NSLog(@"dobe buying"); [[SKPaymentQueue defaultQueue]finishTransaction:transiction]; break; case SKPaymentTransactionStateRestored: break; case SKPaymentTransactionStateFailed: break; } } }
在我在真实设备上测试我的应用程序之前,我退出了应用程序商店。然后运行应用程序并按下音频 IBAction,但它给了我“没有产品”。它甚至没有要求我登录应用商店。这里有什么问题 ?另外,我想知道如果客户删除应用程序并重新安装,我该如何节省购买?
提前致谢 。