iOS 9点播资源可以永久保存吗? [英] Can iOS 9 on-demand resources be kept permanently?

查看:94
本文介绍了iOS 9点播资源可以永久保存吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档,通过NSBundleResourceRequest下载的iOS 9按需资源仅保留直到endAccessingResources被调用,并且在资源请求对象被释放后自动被调用 .

>

好的,但是当应用终止时,一切被释放.那么这是否意味着使用NSBundleResourceRequest下载的资源无法在应用终止后继续生存?我希望使用一种简单的策略来缩小应用程序的大小,以便不包含大量资源,然后再下载它们,从而可以从App Store下载该应用程序.但是如果我不能保留这些资源,那将行不通.我是否应该将资源复制到其他地方并释放NSBundleResourceRequest?

解决方案

我完全按照问题的最后一句话来做:当资源到达时,我将它们复制到应用程序支持"文件夹中,然后释放NSBundleResourceRequest./p>

这似乎有点与按需资源的精神背道而驰,但我认为精神是错误的精神.此功能的设计不是很实用.

According to the documentation, iOS 9 on-demand resources downloaded through a NSBundleResourceRequest are kept only until endAccessingResources is called, and it is called automatically when the resource request object is deallocated.

Okay, but when the app terminates, everything is deallocated. So does this mean that resources downloaded using a NSBundleResourceRequest don't survive termination of the app? I was hoping to use a simple strategy of making my app smaller for download from the App Store by not including a lot of the resources, and then downloading them later; but that's not going to work if I'm not able to keep those resources. Am I expected to copy the resources somewhere else and release the NSBundleResourceRequest?

解决方案

I ended up doing exactly what the question suggests in its last sentence: when the resources arrive, I copy them into the Application Support folder and release the NSBundleResourceRequest.

This seems somewhat against the spirit of on-demand resources, but in my opinion that spirit is the wrong spirit; this feature is not designed in a very practical way.

这篇关于iOS 9点播资源可以永久保存吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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