Downloading On-Demand Resources after updating application version fails.

Originator:neria
Number:rdar://32767758 Date Originated:14.6.17
Status:Open Resolved:No
Product:iOS Product Version:10.3.2
Classification:On Demand Resources Reproducible:100%
 
Area:
Foundation

Summary:
After updating an application version that adds new ODR (new resources with new tags or changed tags to existing resources),
new ODR is not being downloaded, but the ODR's API accessing completion block is invoked without error.

The issue only happens when the update is done via TestFlight (and potentially via AppStore).
With Xcode, on a device / simulator the application downloads the new resources normally.

In a case of installing the application without having any previous version installed, ODR works as expected.

Steps to Reproduce:
Let's say you have 2 version of the app.
Version 1.0 - with any ODR.
Version 1.1 - with additional ODR (new resource and new tag).

0. Uninstall the app if installed before.
1. Install version 1.0 of the app.
2. Run the app and let it download the ODR.
3. Update to app version 1.1.
4. Run the app and let it download the new ODR.
5. Try to access the resource of version 1.1.

Expected Results:
After updating / adding new ODR, we will expect the new resources to be downloaded (step 4), or to get an appropriate error in a case of failure, so that accessing the content (step 5) will not fail.

Observed Results:
1. The completion block of the method beginAccessingResourcesWithCompletionHandler is invoked without error, but the resource is not there.
2. The new resources are never downloaded, also after restart or after initiating a new resource request.
3. In our logs, we can see that beginAccessingResourcesWithCompletionHandler is invoked, but the resource is unavailable through the app bundle.
4. The app folder file:///private/var/mobile/Library/OnDemandResources/AssetPacks/<bundleID>/ does not include the new content as well, except for the previously downloaded files from version 1.0.
5. Only deleting and reinstalling the app can solve this issue and downloading the updated content - which causes On-Demand Resources to lead to a very bad user experience and actually to an unusable API.

Version:
10.0 / 10.3

Notes:
There is a demo project in the attachments, with a simple beginAccessingResourcesWithCompletionHandler on startup, with two resources and two different tags:
1. testImage - tagA
2. testImage2 - tagB

To reproduce the issue with the demo project:
1. Remove testImage2 and its tag from the project, also remove the line that invokes the downloading (line 19).
2. Upload to TestFlight, Install and run and let the ODR to be downloaded - the image should appear on the screen.
3. Add back testImage2 and the deleted line, and tag the new image with tagB .
4. Upload a new version to TestFlight, Update the app to the new version.
5. Run and let the ODR to be downloaded - two images should appear on the screen, but you will see only the first one.
6. After deleting and reinstalling, the ODR works as expected.

By the logs, you can see that beginAccessingResourcesWithCompletionHandler invoked and the unavailable content.

See another related radar: 
https://openradar.appspot.com/29218750

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!