1

I have an app in the app store, and have confirmed that my in-app purchases work for the latest official release. However some of my app users are crafty and they have the unreleased version of iOS. Should my app's in-app purchases still work for beta iOS versions? Because at least one maybe two users are reporting that their in-app purchases are not being marked as purchased correctly.

If you want specifics, nothing much is downloaded when my app marks the item as purchased. It simply writes a file in the docs directory and gives them unlimited plays.

UPDATE:

I have read in the Apple developers forums that

The “store kit flow”, is a process taken at the time of an attempt to purchase an "in app purchase" item such that the store kit determines that there is a problem with the user’s storekit account - for example, when the credit card information has expired. When this issue is detected, the user is given the option to be taken to the App Store app to update their account information. It used to be that the StoreKit would alert the user and ask them to fix the issue in the App Store app, when the issue was detected. Beginning with iOS 7, this check won’t bother the user until an actual charge is attempted - either when an app is requested for download or when a user attempts an in app purchase.

Consequently I think my code may have been finishing transactions early. Here is what I believe to be my relevant code with my suspicions marked. Can someone double check or clarify?

- (void)failedTransaction:(SKPaymentTransaction *)transaction  //Working
{
    //NSLog(@"failedTransaction.");
    if (transaction.error.code != SKErrorPaymentCancelled)
    {
        // error!
        NSLog(@"Transaction error: %@", transaction.error.localizedDescription);
        [self finishTransaction:transaction wasSuccessful:NO]; //TODO: Remove this, it may be causing the bug with transaction errors in Multi Path Audio 1.1.4
    }
    else
    {
        //NSLog(@"failedTransaction, user just cancelled.");
        // this is fine, the user just cancelled
        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
    }
}
Dave Levy
  • 1,036
  • 13
  • 20
  • 1
    Except for possible bugs in 9.1 beta, yes, IAP should work. Perhaps your code is making some bad assumptions that fail under iOS 9. Show your relevant code in your question so people can see if you doing something incorrectly. – rmaddy Sep 13 '15 at 23:52
  • Okay thanks! I have updated my question with some suspect code and more information. – Dave Levy Sep 14 '15 at 12:45
  • On the other hand, beta means beta which means "no right to complain if stuff doesn't work". – gnasher729 Sep 14 '15 at 13:21

1 Answers1

1

You ABSOLUTELY MUST call finishTransaction ONLY when you have delivered the goods to the user. The sequence of actions is: Apple takes the user's money. You deliver the goods. You call finishTransaction. If you don't deliver the goods, that's fine, Apple will remember and ask you again until you call finishTransaction. If you call finishTransaction without delivering, you are cheating the customer.

If the users interaction with the store ends without the user handing over money, you will never be told about the purchase.

gnasher729
  • 51,477
  • 5
  • 75
  • 98
  • I read here on StackOverflow as well as a couple other places that one should call finishTransaction in three places... SKPaymentTransactionStatePurchased, SKPaymentTransactionStateRestored, SKPaymentTransactionStateFailed. Is this correct? http://stackoverflow.com/questions/4988663/skpaymentqueue-addtransactionobserver-asking-for-app-store-password-on-startup-a – Dave Levy Sep 14 '15 at 14:26
  • So I'll maybe create a new test to ensure the goods have been delivered before calling finishTransaction. Thanks for the advice! – Dave Levy Sep 14 '15 at 14:29
  • This was ultimately the correct answer. My Store Kit logic did not return an accurate response in iOS 9 due to the way I was checking it, and I had to add additional logic to ensure the item was purchased and delivered before completing the transaction. Thanks! – Dave Levy Sep 19 '15 at 00:52