Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.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/objective-c/27.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 轻触uibutton打开带有URL参考方案的注释记号_Ios_Objective C_Ipad_Properties_Keynote - Fatal编程技术网

Ios 轻触uibutton打开带有URL参考方案的注释记号

Ios 轻触uibutton打开带有URL参考方案的注释记号,ios,objective-c,ipad,properties,keynote,Ios,Objective C,Ipad,Properties,Keynote,这可能吗?我尝试了以下代码,但无法编译: - (IBAction)KeynoteButton:(id)sender { UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:@"2bm iPad presentation.key"]]; self.controller.de

这可能吗?我尝试了以下代码,但无法编译:

- (IBAction)KeynoteButton:(id)sender {

    UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:@"2bm iPad presentation.key"]];
    self.controller.delegate = self;
    CGRect navRect = self.view.frame;
    [self.controller presentOptionsMenuFromRect:navRect inView:self.view animated:YES];
}

#pragma mark - UIDocumentInteractionControllerDelegate

//===================================================================
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
    return self;
}

- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
    return self.view;
}

- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
    return self.view.frame;
}
它在self.controller上崩溃,因为它不是属性


有什么想法吗?

我想你需要去掉“自我”。因为控制器是一个局部变量。

什么是self的超类?HomeScreenViewController是UIViewControllera的名称,在删除self后,它会在以下错误上崩溃:2013-02-21 19:18:00.094 2bm[2945:907]无法获取URL的数据:操作无法完成。(Cocoa错误260.)2013-02-21 19:18:00.761 2bm[2945:907]***由于未捕获的异常“NSGenericeException”而终止应用程序,原因:'-[UIPopoverController dealloc]在popover仍然可见时到达。'NSBundle*myBundle=[NSBundle mainBundle];NSString*路径;path=[myBundle pathForResource:@“2bm iPad演示文稿”,类型:@“key”];UIDocumentInteractionController*控制器=[UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];您确定文件“2bm iPad presentation.key”在您的包中吗?这就排除了一个错误!仅:**由于未捕获的异常“NSGenericeException”而终止应用程序,原因:“-[UIPopoverController dealloc]在popover仍然可见时到达。”