I have a magazine reader on the App Store. I'm implementing NewsstandKit features at the moment.
My app has this download workflow where users can cancel current downloads at anytime.
I want to enable users to purchase an in-app product and begin that download as a newsstand background download (magazines include multimedia so they are kind of big files) but still preserve that option of they had on previous versions where they could cancel downloads.
Is it possible to achieve this with NKAssetDownload? Or should I remove the whole NKIssue instead?
You should use this method on the asset :
- (void)removeIssue:(NKIssue *)issue
// Remove asset
[[NKLibrary sharedLibrary] removeIssue:[[NKLibrary sharedLibrary]
issueWithName:self.issues[indexPath.row][@"Name"]]];
Description from Apple documentation :
Removes the specified issue from the newsstand content library.
When an issue is removed, any data at the file-system location identified by the issue’s content URL (accessed through the contentURL property of NKIssue) is deleted from disk. If you have issue content elsewhere in the application sandbox, it’s your responsibility to clean it up. Calling this method also cancels any asset downloads for that issue that are underway.
If you remove an issue, corresponding downloads will be canceled.
NKIssue *issue = [[NKLibrary sharedLibrary] issueWithName:editionName];
if (issue)
[[NKLibrary sharedLibrary] removeIssue:issue];
来源:https://stackoverflow.com/questions/8646121/is-it-possible-to-cancel-an-nkassetdownload