Issue with iOS On Demand Resources (ODR) caching

In my app there are multiple games, user can play any of the game that interests him. I have made each game is ODR(Unity - Manual: App thinning) assetbundle.

On the first lunch of any game in the app downloads the ODR assetbundle related to that game. It gets downloaded and cached somewhere (don’t know the exact location even trying OnDemandResourcesRequest.GetResourcePath returns empty string). Later when ever user lunches the same game, it loads the ODR assetbundle from the cache.

This works for fine for some time (a day or something). Later some time this cached ODR assetbundle gets delated somehow and the next time user the plays the game, it gets redownloaded agin from the apple ODR server. So it gives the user wrong impression since the user already has downloaded it.

I am unloading the assetbundle and disposing the OnDemandResourcesRequest when ever user switches from on game to another. Is this a problem ? What is the right way to handle this ?

You are doing it right by releasing the bundle whenever you don’t need it. This is more or less the intended behavior and there is no way to force iOS to keep a ODR bundle on the device forever. The criteria of iOS removing a downloaded ODR bundle is not known. Quoting Apple’s words:

Also see this StackOverflow answer: ios9 - Can iOS 9 on-demand resources be kept permanently? - Stack Overflow

Neonlyte thanks for the reply