为什么iOS FaceBook共享显示空图像框甚至提供图像?

时间:2015-10-23 10:17:48

标签: ios objective-c xcode7 uidocumentinteraction

所有工作正常除非我在我的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";
    }

0 个答案:

没有答案