All Works Fine except when I press Facebook share button in my iOS app, it loads and shows me an Empty image box. Any idea? Log error: [Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior]
- (void)share {
_img = [UIImage imageNamed:@"face11.jpg"];
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/tmptmpimg.png"];
[UIImageJPEGRepresentation(_img, 1.0) writeToFile:path atomically:YES];
NSString *path1 = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/tmptmpimg.ig"];
[UIImageJPEGRepresentation(_img, 1.0) writeToFile:path1 atomically:YES];
NSLog(@"Path %@",path);
_documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];
_documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path1]];
_documentInteractionController.delegate = self;
[_documentInteractionController presentOptionsMenuFromRect:CGRectZero inView:self.view animated:YES];
}
- (void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(NSString *)application
{
NSString *savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/tmptmpimg.ig"];
[UIImageJPEGRepresentation(_img, 1.0) writeToFile:savePath atomically:YES];
controller.URL = [NSURL fileURLWithPath:savePath];
NSLog(@"SavePath %@",savePath);
controller.UTI = @"com.instagram.exclusivegram";
}