开发者

Problems with testing in app purchases

开发者 https://www.devze.com 2022-12-25 03:28 出处:网络
I am trying to test my application with in app purchases. I created features, test user, logged out from iTunes on the iPhone and used developer certificate. Load app from XCode in debug mode.

I am trying to test my application with in app purchases. I created features, test user, logged out from iTunes on the iPhone and used developer certificate. Load app from XCode in debug mode.

When I click "Buy" button I pass all checks for internet availability, canMakePayments and call

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

But all what I see is a pending view and after some minutes it failed in

- (void) failedTransaction: (SKPaymentTransaction *)transaction
{   
    if (transaction.error.code != SKErrorPaymentCancelled)      
    {       
        NSLog(@"failedTransaction");
    }   
    [[MKStoreManager sharedManager] paymentCanceled];
开发者_如何学JAVA    [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; 
}

Please advice in what direction I should go to figure out the problem and what else I should check.

P.S. All related questions on SO were checked with no luck.


Here you have some ideas:

  1. Load the products before allowing the user to make purchases. The first thing you need to do is a SKProductsRequest and make sure the products you are offering can be purchased.

  2. Discriminate the error, Check SKError.h to see the different kinds of errors the store can return. This way you will have a clearer idea of what's going on

  3. Some errors, like -1003, are not documented and they seem to be weird cases in the sandbox environment.

  4. For those errors, make sure you:

    • Use the correct test user.
    • Have properly configured the products in iTunes connect.
    • Logout from the store and clean install the app. Login only when you are asked to do so in the buy confirmation popup.
    • If this fails, reset the network settings, clean install the app and test again.
    • If this fails, reset all settings, clean install the app and test again.
    • If this fails, reset your device, clean install the app and test again.

Finally, take a look at these pages:

http://troybrant.net/blog/2010/01/invalid-product-ids/

http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/

0

精彩评论

暂无评论...
验证码 换一张
取 消