iosobjective-cipadpropertieskeynote

Open keynote with URL reference scheme on touch of uibutton


Is this possible? I have tried this code below but I cannot get it to compile:

- (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;
}

It crashes on self.controller as it is not a property.

Any ideas?


Solution

  • I think you need to take out "self.". Since controller is a local variable.