My UIDocumentsInteractionController is working as far as presenting an action sheet with a button that says "iBooks" but when I click on that button, it just dismisses and it doesn't take me to iBooks. Here's my code:
NSString *filenamePath =[NSString stringWithFormat:@"temp.%@", [[file path] pathExtension]];
NSString *docDir = [DataCenter getDocumentsDirectoryPath];
NSString *fullPath = [docDir stringByAppendingPathComponent:filenamePath];
NSURL *url = [NSURL fileURLWithPath:fullPath];
UIDocumentInteractionController *c = [UIDocumentInteractionController interactionControllerWithURL:url];
BOOL success = [c presentOpenInMenuFromBarButtonItem:buttonBack animated:YES];
What am I doing wrong? Thanks
For those stuck at this: You don't need to set yourself up as UIDocumentInteractionController's delegate at all.
Problem was [UIDocumentInteractionController interactionControllerWithURL:url]
is being autoreleased. It thought it would be retained internally by the action sheet being shown but apparently it's not.
So yea, gotta retain it until action sheet dismisses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With