Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.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/9/javascript/427.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 UIDocumentInteractionController不打开文档/收件箱文件夹中的文件_Ios_Uidocumentinteraction - Fatal编程技术网

Ios UIDocumentInteractionController不打开文档/收件箱文件夹中的文件

Ios UIDocumentInteractionController不打开文档/收件箱文件夹中的文件,ios,uidocumentinteraction,Ios,Uidocumentinteraction,我们的iOS应用程序实现了“在中打开”选项。当用户选择我们的应用程序打开文件时,我们将使用UIDocumentInteractionController显示该文件 在应用程序代理中,我们有: - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { if

我们的iOS应用程序实现了“在中打开”选项。当用户选择我们的应用程序打开文件时,我们将使用UIDocumentInteractionController显示该文件

在应用程序代理中,我们有:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{

    if (url != nil && [url isFileURL])
    {
        [self.viewController handleDocumentOpenURL:url];
    }

    return YES;
}
然后

- (void)handleDocumentOpenURL:(NSURL *)url
{
  NSFileManager *fileManager = [NSFileManager defaultManager];

  BOOL fileExists = [fileManager fileExistsAtPath:[url path]];
  if (fileExists)
    NSLog(@"The file exists");
  else
    NSLog(@"The file doesn't exists");

  UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:url];
  controller.delegate = self;
  [controller presentPreviewAnimated:YES];
}
-(UIViewController*)DocumentInteractionControllerServiceControllerForpReview:(UIDocumentInteractionController*)控制器
返回自身

它在iOS 7上运行得很好,但由于iOS 8,它就不工作了(在iOS 8上)。在iOS 8上,预览程序仅显示带有文件名的灰色屏幕

这些文件由系统保存在Documents/Inbox文件夹中

如果我们将文件复制到另一个文件夹,并尝试显示复制是有效的。。。很奇怪


有什么想法吗?

请分享代码。可能会发生的原因有很多,但如果不看看它是如何到达那里的,就无法确定