#define KdownloadsPath NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory, NSUserDomainMask, YES).firstObject
_downloadedPath = [KdownloadsPath stringByAppendingPathComponent:fileName];
_downloadingPath = [_downloadedPath stringByAppendingString:@".download"];
NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:
@"NSProgressFileOperationKindDownloading", @"NSProgressFileOperationKindKey",
[NSURL fileURLWithPath:_downloadingPath], @"NSProgressFileURLKey",
nil];
self.progress = [[NSProgress alloc] initWithParent:nil userInfo:info];
[self.progress setKind:@"NSProgressKindFile"];
[self.progress setPausable:NO];
[self.progress setCancellable:YES];
[self.progress setTotalUnitCount:_totalBytes];
[self.progress publish];
(updating the progress indicator happens elsewhere)
I'm creating an NSProgress object to show a progress indicator underneat a file in my Downloads directory. The entitlements includes com.apple.security.files.downloads.read-write
.
The indicator does not show when NSProgressFileURLKey
points to the sandboxed file path, e.g. /Users/mdbraber/Library/Containers/com.mdbraber.TestApp/Data/Downloads/Test.pptx.download
. It does work when NSProgressFileURLKey
points to the direct download location which the sandbox links to e.g. /Users/mdbraber/Downloads/Test.pptx.download
Is this a bug or should I use something else for NSProgressFileURLKey
to make this work?