是否可以取消NKAssetDownload? [英] Is it possible to cancel an NKAssetDownload?

查看:145
本文介绍了是否可以取消NKAssetDownload?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在App Store上有一本杂志阅读器。我目前正在实施NewsstandKit功能。

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.

是否可以通过NKAssetDownload实现这一目标?或者我应该删除整个NKIssue吗?

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"]]];

Apple文档说明:

从报亭内容库中删除指定的问题。
删除问题后,将从磁盘中删除由问题的内容URL(通过NKIssue的contentURL属性访问)标识的文件系统位置的任何数据。如果您在应用程序沙箱中的其他位置有问题内容,​​则您有责任进行清理。 调用此方法也会取消正在进行的该问题的任何资产下载。

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.

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

这篇关于是否可以取消NKAssetDownload?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆