NSProgress不使用沙盒项目?
我正在创建一个nsprogress对象,以在下载目录中显示一个文件下的进度指标。授权包括com.apple.security.files.downloads.read-write
。 该指示器未显示nsprogressfileurlkey
指向沙盒文件路径,例如/users/mdbraber/mdbraber/library/containers/containers/comcom.mdbraber.testapp/datapapp/data/data/data/downa/test.pptx.pptx.downloads /代码>。当
nsprogressfileurlkey
指向Sandbox链接到EG /users/mdbraber/mdbraber/downloads/test.pptx.download
时,它确实可以工作
。为NSProgressFileUrlkey使用其他功能来制作这项工作吗?
#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];
(更新进度指标发生在其他地方)
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?
#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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论