Share to Instagram を iPhone アプリに統合しようとしていますが、編集した画像を Instagram で開くことができません。
これが私が試しているコードです:
mainToolBar.hidden = YES;
colorToolBar.hidden = YES;
[self.view setNeedsDisplay];
UIGraphicsBeginImageContext(CGSizeMake(320, 416));
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * imageA = [UIImage imageWithData:UIImageJPEGRepresentation(UIGraphicsGetImageFromCurrentImageContext(), 1.0)];
UIGraphicsEndImageContext();
mainToolBar.hidden = NO;
colorToolBar.hidden = NO;
NSString * documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString * savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Image.ig"];
NSData * imageData = UIImagePNGRepresentation(imageA);
[imageData writeToFile:savedImagePath atomically:YES];
NSURL * imageUrl = [NSURL fileURLWithPath:savedImagePath];
UIDocumentInteractionController * docController = [[UIDocumentInteractionController alloc] init];
docController.delegate = self;
[docController retain];
docController.UTI = @"com.instagram.photo";
[docController setURL:imageUrl];
[docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
imageData を UIImagePNGRepresentation(self.image) に設定すると、画像は表示されますが、編集された画像 (描画/着色アプリ) ではなく、元の画像だけが表示されます。
私が欠けているものを見るのを手伝ってくれる人はいますか?
どうもありがとう!