How to re-download in app purchase content host data?

Hello Friends,


I have created an iOS application for IAP and also enable the content hosting in iTunes connect. After that i have uploaded some content against that product ID for content hosting. I also did IAP coding part. Content download is working when i purchased that product. and content downloaded inside the cache folder after that i have copy those data to the Document folder.


But my question is that, when I have deleted downloaded data from document folder and I tried to restore download data, some time it's working and some time not?

And also let me know how could i re-download only one product ID contents from multi product ID contents?


Please let me know if you have any solution in you mind.



Thanks

Rajaram

Accepted Reply

Hi Rajaram,


I don't have an answer to your question but I think you might be a step ahead of me. I have downloaded an In App Purchase package which is downloaded to the Caches directory.


How do I unpack the directory and access the files within?


I think I need to use the File Manager but its very confusing - do you have any ideas?


Cheers

Steve

Replies

Hi Rajaram,


I don't have an answer to your question but I think you might be a step ahead of me. I have downloaded an In App Purchase package which is downloaded to the Caches directory.


How do I unpack the directory and access the files within?


I think I need to use the File Manager but its very confusing - do you have any ideas?


Cheers

Steve

Hello Steve,


You have to copy all those downloded files to you document folder by using NSFileManager class copyItemAtPath method.


Then you can see all those data inside the document folder.



NSString *zipFolderPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0] stringByAppendingPathComponent:[download.contentURL.lastPathComponent stringByAppendingString:@"/Contents"]];

[[NSFileManager defaultManager] copyItemAtPath:zipFolderPath toPath:"destination path" error:&error];


Thanks

Rajaram