Can I cancel NKAssetDownload?

I have a reader magazine in the App Store. I am currently implementing NewsstandKit features.

My application has this download workflow in which users can cancel current downloads at any time.

I want users to be able to purchase the product in the application and start downloading as a downloadable soundtrack (the logs include multimedia, therefore they are large files), but at the same time retain this option, which they had in previous versions, where they could cancel loading.

Is it possible to achieve this with NKAssetDownload? Or should I remove the entire NKIssue?

+4
source share
2 answers

You must use this method for an asset:

- (void)removeIssue:(NKIssue *)issue // Remove asset [[NKLibrary sharedLibrary] removeIssue:[[NKLibrary sharedLibrary] issueWithName:self.issues[indexPath.row][@"Name"]]]; 

Description of Apple documentation:
Removes the indicated problem from the newsstand content library. When the problem is deleted, any data in the file system location identified by the URL of the content of the problems (access via the contentURL property NKIssue) is deleted from the disk. If you have a problem with content elsewhere in the application sandbox, it is your responsibility to clean it. Calling this method also cancels loading any resource for this problem.

Source: http://developer.apple.com/library/ios/documentation/StoreKit/Reference/NKLibrary_Class/NKLibrary/NKLibrary.html#//apple_ref/doc/uid/TP40010835-CH2-SW2

+2
source

If you remove the problem, the corresponding downloads will be canceled.

 NKIssue *issue = [[NKLibrary sharedLibrary] issueWithName:editionName]; if (issue) [[NKLibrary sharedLibrary] removeIssue:issue]; 
+8
source

Source: https://habr.com/ru/post/1388152/


All Articles