Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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 QLViewController显示PDF文件,但“活动”视图显示为空。没有列出任何应用程序_Ios_Objective C_Pdf_Qlpreviewcontroller_Uiactivityviewcontroller - Fatal编程技术网

Ios QLViewController显示PDF文件,但“活动”视图显示为空。没有列出任何应用程序

Ios QLViewController显示PDF文件,但“活动”视图显示为空。没有列出任何应用程序,ios,objective-c,pdf,qlpreviewcontroller,uiactivityviewcontroller,Ios,Objective C,Pdf,Qlpreviewcontroller,Uiactivityviewcontroller,我有一个下载pdf文件的应用程序,然后使用QLViewController显示。点击顶部栏中的“共享”按钮将显示一个空的活动视图。它应该包含“打印”、“在iBooks中打开”等内容 截图: 如果我通过XCode运行我的应用程序,一切都正常,但是如果我创建一个临时构建,我会得到屏幕截图中显示的空菜单。下面是我的代码: - (void) DisplayFileWorker: (const wchar_t*) fileName { iOSClient_AppDelegate *appDeleg

我有一个下载pdf文件的应用程序,然后使用QLViewController显示。点击顶部栏中的“共享”按钮将显示一个空的活动视图。它应该包含“打印”、“在iBooks中打开”等内容

截图:

如果我通过XCode运行我的应用程序,一切都正常,但是如果我创建一个临时构建,我会得到屏幕截图中显示的空菜单。下面是我的代码:

- (void) DisplayFileWorker: (const wchar_t*) fileName
{
    iOSClient_AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];

    QLPreviewController *previewController = [[QLPreviewController alloc]init];
    previewController.delegate = appDelegate.serverViewController;
    previewController.dataSource = appDelegate.serverViewController;
    previewController.currentPreviewItemIndex = 0;

    NSString* filePath = [[NSString alloc] initWithBytes: (const void*)fileName
                                              length: wcslen(fileName) * sizeof(*fileName)
                                            encoding: NSUTF32LittleEndianStringEncoding];

    appDelegate.serverViewController.previewFile = filePath;

    [appDelegate.serverViewController presentModalViewController:previewController animated:YES];

    [previewController release]; 
}

我尝试过将文件复制到其他地方,更改文件的权限,将pdf文件添加到资源中,我总是得到相同的空白菜单。有什么想法吗?

文件的扩展名是什么?filePath变量在调试器中显示了什么?