2011-12-19 3 views
0

В настоящее время я работаю над функцией покупки приложений, и я получаю ниже ошибкиError Domain = SKErrorDomain Code = 3 «Не удается подключиться к iTunes Store» UserInfo = 0x1aaf40 {NSLocalizedDescription = Не удается подключиться к iTunes Store}

"Ошибка домена = SKErrorDomain Code = 3 "не удается подключиться к ITunes магазин" UserInfo = 0x1aaf40 {NSLocalizedDescription = не удается подключиться к ITunes магазин}"

Вот шаг.

1) Сначала я создать одно приложение "inAppPro" и находится под (Status): "Подготовка к загрузке"

enter image description here

2) я добавил 4 неплавящимся продукт , а также заполнить соответствующие детали.

enter image description here enter image description here

3) Я также создать тест пользователя (песочница) для испытания в-App покупки продукта.

4) Я также создал профиль профиля с включением inApp Purchase.

5) Я также создал APP ID без (*) wild card.

Вот код, который я использую.

- (void)viewDidLoad 
{ 
    Detail1 *observer = [[Detail1 alloc] init]; 

    [[SKPaymentQueue defaultQueue] addTransactionObserver:observer]; 

    [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]; 

    [super viewDidLoad]; 
    // Do any additional setup after loading the view from its nib. 
} 


- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response 
{ 

    if ([SKPaymentQueue canMakePayments]) 
    { 
     NSString *product = [NSString stringWithFormat:@"com.companyname.inAppDemo.module%d",ApplicationDelegate.objectID]; 
     NSLog(@"In-App product for request = %@", product); 

     SKPayment *payment = [SKPayment paymentWithProductIdentifier:product]; 
     [[SKPaymentQueue defaultQueue] addPayment:payment]; 


    } 
    else 
    { 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MyApp" message:@"You are not authorized to purchase from AppStore" 
                 delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; 
     [alert show]; 
     [alert release]; 
    } 
} 
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions 
{ 
    for (SKPaymentTransaction *transaction in transactions) 
    { 
     switch (transaction.transactionState) 
     { 
      case SKPaymentTransactionStatePurchased: 

       [self completeTransaction:transaction]; 

       break; 

      case SKPaymentTransactionStateFailed: 

       [self failedTransaction:transaction]; 

       break; 

      case SKPaymentTransactionStateRestored: 

       [self restoreTransaction:transaction]; 

      default: 

       break; 
     }   
    } 
} 
- (void) failedTransaction: (SKPaymentTransaction *)transaction 
{ 
    if (transaction.error.code != SKErrorPaymentCancelled)  
    {  
     // Optionally, display an error here. 
     NSLog(@"%@",transaction.error); 

    } 
    [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; 
} 

- (void) completeTransaction: (SKPaymentTransaction *)transaction 
{  
    //[[MKStoreManager sharedManager] provideContent: transaction.payment.productIdentifier]; 
    [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; 
} 

- (void) restoreTransaction: (SKPaymentTransaction *)transaction 
{ 
    //[[MKStoreManager sharedManager] provideContent: transaction.originalTransaction.payment.productIdentifier]; 
    [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; 
} 
-(IBAction)btnpurchase:(id)sender 
{ 
    NSLog(@"ProductStatus = %@", ApplicationDelegate.productStatus); 

    if ([ApplicationDelegate.productStatus isEqualToString:@"FREE"]) 
    { 
     UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"This is free for you so ENJOY it!!!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil]; 
     [alert show]; 
     [alert release]; 
    } 
    else if ([ApplicationDelegate.productStatus isEqualToString:@"PAID"]) 
    { 
     UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"You have already purchase it!!!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil]; 
     [alert show]; 
     [alert release]; 
    } 
    else 
    { 
     NSLog(@"Detail1 id for product = %d", ApplicationDelegate.objectID); 
     NSString *product = [NSString stringWithFormat:@"com.companyname.inAppDemo.module%d",ApplicationDelegate.objectID]; 
     NSLog(@"In-App product-id = %@", product); 



     SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObjects:product,nil]]; 
     request.delegate = self; 
     [request start]; 

    } 
} 

Пожалуйста, помогите мне.

Заранее спасибо.

ответ

2

У вас должны быть действующие договоры, действующие в разделе «Контракты, налоги и банковское дело». И, конечно же, убедитесь, что вы используете правильный профиль Provisioning Profile и что вы включили в App Purchase для этого идентификатора, и (последний), что вы добавили покупаемые элементы в iTunes Connect (что вы сделали, как показывают снимки экрана).