First, in your code, you are not assigning the return value of setupControllerWithURL: usingDelegate: object, so this method does not actually do anything by simply creating a new instance of UIDocumentInteractionController and discarding it.
Secondly, from the documentation:
"Note that the caller of this method needs to retain the returned object."
You do not save the controller document (or assign it to a strictly specified property in the case of ARC) from what I can say.
Try this - In your @interface:
@property (nonatomic, strong) UIDocumentInteractionController *documentController;
In your @implementation:
self.documentController = [UIDocumentInteractionController interactionControllerWithURL:igImageHookFile]; self.documentController.delegate = self; self.documentController.UTI = @"com.instagram.photo"; [self.documentController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
In addition, the string NSURL *igImageHookFile = [[NSURL alloc] init]; not needed, because in the next line igImageHookFile = [NSURL fileURLWithPath:jpgPath]; you create a new instance and discard the first. Just use NSURL *igImageHookFile = [NSURL fileURLWithPath:jpgPath];
source share