I ran into the problem of OnDemandResource
:
1) I download from TestFlight
the old version App... App downloads OnDemandResource
and everything works fine.
2) I upload a new version App in which I add new resources, and install it as an update on the old version. And when the new version App is running, not download of new OnDemandResource
, App believes that all resources are downloaded.
How to fix it?
First start old version:
NSSet *tags = [NSSet setWithObjects: @"PACK_1", @"PACK_2", nil];
NSBundleResourceRequest *resourceRequest = [[NSBundleResourceRequest alloc] initWithTags:tags];
resourceRequest.loadingPriority = 1.0;
[resourceRequest conditionallyBeginAccessingResourcesWithCompletionHandler:^(BOOL resourcesAvailable) {
if (resourcesAvailable) {
} else {
// Download PACK_1 and PACK_2
[resourceRequest beginAccessingResourcesWithCompletionHandler:^(NSError * __nullable error) {
if(!error){
} else {
// Run App
}
}];
}
}];
First start new version (updated old version, add new PACK_3):
NSSet *tags = [NSSet setWithObjects: @"PACK_1", @"PACK_2", @"PACK_3", nil];
NSBundleResourceRequest *resourceRequest = [[NSBundleResourceRequest alloc] initWithTags:tags];
resourceRequest.loadingPriority = 1.0;
[resourceRequest conditionallyBeginAccessingResourcesWithCompletionHandler:^(BOOL resourcesAvailable) {
// Check PACK_1, PACK_2 and PACK_3 and resourcesAvailable = true, but PACK_3 not download
if (resourcesAvailable) {
// Run App
} else {
// Will not start to download PACK_3
[resourceRequest beginAccessingResourcesWithCompletionHandler:^(NSError * __nullable error) {
if(!error){
} else {
}
}];
}
}];