IOS downloads inappropriate content from an in-app purchase server

I read and searched for everything I could in the iOS theme in the application. At least from Google (minus endless links for hacking applications). One thing I cannot find is instructions or tutorials on how to grab content from the server and save it on the phone after confirming receipt. I get that I can either store content on my own server or package it using the application loader, and Apple supports it. I get all unused content and use my own server or NSUserDefaults to remember the items I purchased. What I cannot find are coding tutorials on how to get content for purchases inside the application from my own server or Apple, and where can I save it on the phone? normal socket call? Can I save the contents in the application directory?

As an example, I have an existing application that I would like to sell new images through in-app purchases. Existing images are included. How can I get the attached images from the server back to my application? I agree with the new links for each purchase, I understand that you can not modify the existing package.

+5
source share
1 answer

When your purchase is successful, you will receive a transaction object. Is not it?

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

Iterate through each transaction object and use the following code:

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

Upon successful upload, you will receive a delegate call:

-(void)paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray *)downloads
{
    for (SKDownload *download in downloads)
    {
        switch (download.downloadState) {
            case SKDownloadStateActive:
                NSLog(@"Download progress = %f and Download time: %f", download.progress, download.timeRemaining);
                break;
            case SKDownloadStateFinished:
                NSLog(@"%@",download.contentURL);
                // Download is complete. Content file URL is at
                // path referenced by download.contentURL. Move
                // it somewhere safe, unpack it and give the user
                // access to it
                break;
            default:
                break;
        }
    }
}

URL-, , ( ). .

+3

All Articles