Ios 应用内购买不适用于iPhone 3,4
在iPhone5上一切都很好,但在iPhone3,4上,我在按下购买按钮后得到了事务失败状态。。。 我尝试了几乎所有的方法,但总是遇到同样的问题,如果你遇到同样的问题并且知道答案,请帮助我,这不需要一分钟;)谢谢Ios 应用内购买不适用于iPhone 3,4,ios,iphone,in-app-purchase,Ios,Iphone,In App Purchase,在iPhone5上一切都很好,但在iPhone3,4上,我在按下购买按钮后得到了事务失败状态。。。 我尝试了几乎所有的方法,但总是遇到同样的问题,如果你遇到同样的问题并且知道答案,请帮助我,这不需要一分钟;)谢谢 您是否向苹果提交了应用程序的版本?您需要提交它,选择应用商店内的项目,然后拒绝它(因为它还不是最终版本)。 另外,在这之后留出一些时间(12个小时左右,因为我看到有时会有很长的延迟)。 还有一件事,使用美国测试帐户和提交给美国商店的物品(我记得在过去的项目中还有其他失败的项目)。我认为
您是否向苹果提交了应用程序的版本?您需要提交它,选择应用商店内的项目,然后拒绝它(因为它还不是最终版本)。 另外,在这之后留出一些时间(12个小时左右,因为我看到有时会有很长的延迟)。
还有一件事,使用美国测试帐户和提交给美国商店的物品(我记得在过去的项目中还有其他失败的项目)。我认为这与手机型号无关 应用程序是否处于沙盒模式?如果是,手机上不得储存任何iTunes帐户。在每部手机上从您的帐户注销。您可以使用在iTunes Connect中创建的“测试用户”帐户“仅”成功测试 我想你在iTunes Connect中做了关于IAP的所有安排,添加了产品,因为你说它在一部手机上工作
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:{
// show wait view here
NSLog(@"Processing...");
break;
}
case SKPaymentTransactionStatePurchased:{
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
// remove wait view and unlock feature 2
NSLog(@"DONE!");
[prefs setObject:@"yes" forKey:@"payed"];
self.buyButton.hidden = TRUE;
[self getData:@"yes"];
break;
}
case SKPaymentTransactionStateRestored:{
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
NSLog(@"Error payment cancelled2");
break;
}
case SKPaymentTransactionStateFailed:{
if (transaction.error.code != SKErrorPaymentCancelled) {
NSLog(@"Error payment cancelled1:%@",transaction.error.description);
}
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
}
default:{
break;
}
}
}
}
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
// remove wait view here
//statusLabel.text = @"";
int count = [response.products count];
if (count>0) {
SKProduct *validProduct = [response.products objectAtIndex:0];
//SKPayment *payment = [SKPayment paymentWithProduct:validProduct];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:validProduct];
[[SKPaymentQueue defaultQueue] addPayment:payment];
} else {
// no products found
}
}
-(void)requestDidFinish:(SKRequest *)request
{
}
-(void)request:(SKRequest *)request didFailWithError:(NSError *)error
{
NSLog(@"Failed to connect with error: %@", [error localizedDescription]);
}
#pragma mark AlertView Delegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"%d",buttonIndex);
if (alertView==askToPurchase) {
if (buttonIndex==1) {
// user tapped YES, but we need to check if IAP is enabled or not.
if ([SKPaymentQueue canMakePayments]) {
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"com.adam.CrowdControl.adamProduct1"]];
request.delegate = self;
[request start];
} else {
UIAlertView *tmp = [[UIAlertView alloc]
initWithTitle:@"Prohibited"
message:@"Parental Control is enabled, cannot make a purchase!"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Ok", nil];
[tmp show];
}
}
}
}