Is it possible to cancel an NKAssetDownload?

时间秒杀一切 提交于 2019-12-05 14:31:09

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.

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

If you remove an issue, corresponding downloads will be canceled.

NKIssue *issue = [[NKLibrary sharedLibrary] issueWithName:editionName]; 
if (issue)
    [[NKLibrary sharedLibrary] removeIssue:issue];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!