所有工作正常除非我在我的iOS应用中按 Facebook 分享按钮,它会加载并向我显示空图像框。任何的想法? 记录错误: [不允许在取消分配时尝试加载视图控制器的视图,并且可能导致未定义的行为]
- (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";
}