objective-cin-app-purchasestorekitskpaymenttransactionskdownload

Apple In-App Purchase with hosted content - doesn't download files


I created a simple in-app purchase product, with a single mp3 file in it as content. I set it up in itunes connect, uploaded the pkg file, everything went well - the product is recognized from within my app, the user can buy it, the confirmation comes as expected, however, there is a small problem: when the transaction state changes to "purchased", I call the content download method, to start downloading the mp3 file, however, the update method never gets called (- (void)paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray *)downloads), instead the transaction gets removed.

What am I doing wrong? Where should I call the start download method from below?

if (transaction.downloads)
{
    [[SKPaymentQueue defaultQueue] startDownloads:transaction.downloads];
}

Solution

  • Sorry, my mistake, I started the file download in the

    - (void) finishTransaction:(SKPaymentTransaction *) transaction wasSuccessful:(BOOL) wasSuccessful
    

    method, not in

    - (void) paymentQueue:(SKPaymentQueue *) queue updatedTransactions:(NSArray *) transactions