问题
I am trying to use ODR in our application and have created Tags and grouped it under Initial Install Tags option under Prefetched.
- I am not sure how to verify this on the Simulator and on the Device using the Development Profile.
- Is TestFlight the only option to verify Initial Install Tag usage?
- Do I have to use NSBundleResourceRequest even for resources tagged as Initial Install? My understanding of Initial Install Tag is that, it would be automatically downloaded with the app. So, I thought the request is not needed. Please correct me if I am wrong.
回答1:
According to WWDC https://developer.apple.com/videos/play/wwdc2015/214/
1) You can verify ODR by using the disk section of debug navigator in X Code
However as of XCode 8.1 beta the initial install tag does not deem to work as expected. As you can see in the screenshot attached.
2) According to the my understanding of WWDC this should work on Archive version and also on Simulator by simply running the app from XCode. Not only TestFlight
3) I do not believe that you should have to use a separate fetch request, but as this seems to be the only way to get it working, this should be seen as a workaround rather than a solution. According to the documentation
Initial install tags. The resources are downloaded at the same time as the app. The size of the resources is included in the total size for the app in the App Store. The tags can be purged when they are not being accessed by at least one NSBundleResourceRequest object.
So in my opinion this feature is just not working as documented and expected and a bug should be filed with Apple. That seems to be the conclusion on Apple Forums
https://forums.developer.apple.com/thread/9530
https://forums.developer.apple.com/thread/9530
回答2:
I got ODR support implemented in our application using Initial Install Tags (Though I have not tested it using TestFlight).
- I am not sure how to verify this on the Simulator and on the Device using the Development Profile. -- I tested locally by embedding the Asset packs in the Bundle itself.
- Is TestFlight the only option to verify Initial Install Tag usage? -- Have not tested this yet. But, I think the answer is Yes.
- Do I have to use NSBundleResourceRequest even for resources tagged as Initial Install? -- Yes. There is no difference between how we fetch resources tagged under "Download Only On Demand", "Initial Install Tags" and "Prefetched Tag Order"
And I had made one change that made my app use the ODR content properly. I was having the NSBundleResourceRequest object as a local variable. It should have been an instance variable. Ref: https://iosguy.com/2015/09/18/on-demand-resources/
来源:https://stackoverflow.com/questions/39134879/initial-install-tags-usage-and-verification-during-development