0

I am start to use ODR in my application.

The code is fine for normal case except the following scenario:

When the download process is break (press Home key), NSBundleResourceRequest.beginAccessingResources becomes never complete in second time. In debug, Disk usage: the App is hold in Downloading state.

Here is my code:

[bundleResourceRequest conditionallyBeginAccessingResourcesWithCompletionHandler:^(BOOL resourcesAvailable) {
    if(resourcesAvailable == YES) {
        NSLog(@"<!> Resource is available.");
    } else {
        NSLog(@"<!> Resource is NOT available.");
        [bundleResourceRequest beginAccessingResourcesWithCompletionHandler:^(NSError * __nullable error) {
            // This part of code is never reach agin if download progress is break…….
        }];
    }
}];

The documentation is so simple but couldn't find any help regarding this issue.

Would anyone help me? Thanks.

Simon Lam
  • 1
  • 1
  • Did you solve this? I'm having the same issue. Some tags are stuck on "Downloading" and there's nothing I can do to change that. Using https://developer.apple.com/documentation/foundation/nsbundleresourcerequest/1614840-beginaccessingresources on those resources results in the `completionHandler` never been called. I'm very certain that my code is fine; and as you said, the API is rather simple. And yet, those resources are unreachable unless the app is deleted and reinstalled, which is no fix. This has been happening to some users, so doesn't necessarily have to do with Xcode. – Xtian D. Aug 14 '20 at 11:55

1 Answers1

0

From my experience with this same issue, it appears that using Xcode to purge the downloaded resources is a bad idea. If you need to reset to test downloads again, delete the app from the simulator or device. Then do a clean build and try again.

SarahR
  • 905
  • 8
  • 12