Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 处于移动或导出模式的DocumentPickerViewController被不存在的URL解除(创建文档提供程序应用程序扩展)_Ios_Url_Swift_Ios App Extension_Uidocument - Fatal编程技术网

Ios 处于移动或导出模式的DocumentPickerViewController被不存在的URL解除(创建文档提供程序应用程序扩展)

Ios 处于移动或导出模式的DocumentPickerViewController被不存在的URL解除(创建文档提供程序应用程序扩展),ios,url,swift,ios-app-extension,uidocument,Ios,Url,Swift,Ios App Extension,Uidocument,我目前正在尝试实现移动和导出模式的功能。我所做的就是让用户导航到他们想要移动/导出文件的目录,然后在他们选择的目录上调用dismissGrantingAccessToURL,并附加原始文件的文件名。下面是它在代码中的外观: let moveDestinationPath = self.currentDirectory.path.stringByAppendingPathComponent(AppHelper.Stored.originalURL!.lastPathComponent) deleg

我目前正在尝试实现移动和导出模式的功能。我所做的就是让用户导航到他们想要移动/导出文件的目录,然后在他们选择的目录上调用dismissGrantingAccessToURL,并附加原始文件的文件名。下面是它在代码中的外观:

let moveDestinationPath = self.currentDirectory.path.stringByAppendingPathComponent(AppHelper.Stored.originalURL!.lastPathComponent)
delegate.finishWithURL(NSURL.fileURLWithPath(moveDestinationPath))
我认为这应该足够了,因为文件中说:

导出文档选取器模式。提供所选目标的URL。此URL需要仅由文档选择器视图控制器扩展访问。系统在此URL处保存文档副本,并将URL返回到主机应用程序以表示成功。主机应用程序无法访问此URL处的文档

移动文档选择器模式。提供所选目标的URL。URL需要包含在documentStorageURL属性所引用的层次结构中。系统将文档移动到此URL,并将URL返回到主机应用程序。然后,主机应用程序可以通过新的URL访问该文档

但是,当我运行此代码时,会出现以下错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: '<TestDocumentProvider.DocumentPickerViewController: 0x7c470770> was 
dismissed with a nonexistent URL (file:///Users/test/Library/Developer/CoreSimulator
/Devices/6867B1A7-8694-4D6D-8480-69FE89F39C27/data/Containers/Shared/AppGroup/74A2FBED-
70C5-4F24-8345-AD35FEB86D01/FileProviderStorage/Directory1/apple1.png) 
in Move or Export mode'
由于未捕获异常“NSInternalInconsistencyException”而终止应用程序,
原因:“是
用不存在的URL驳回(file:///Users/test/Library/Developer/CoreSimulator
/设备/6867B1A7-8694-4D6D-8480-69FE89F39C27/data/Containers/Shared/AppGroup/74A2FBED-
70C5-4F24-8345-AD35FEB86D01/FileProviderStorage/Directory1/apple1.png)
处于移动或导出模式'
鉴于此错误,他们似乎希望我手动将文件移动或复制到自己的原始URL。但这与文档中所说的(关于系统执行此操作的部分)相矛盾


那么,有人知道苹果公司打算让我在这种情况下做什么吗?现在,我可能会自己移动/复制…

我想你误解了导出模式。 目标是,有人选择您的扩展名可以访问的文件。您可以下载/提供它,并向请求应用程序提供文件URL

您真正想要做的是导入模式