您好我需要導入Instagram的我編輯的圖像開放的形象,像PhotoStudio中:與Instagram的
我俘獲了我的這個代碼映像:
UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0);
[self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
然後,我需要用Instagram打開screenShot
:
EDITED:
我實現這樣的方法:
UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0);
[self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]];
docFile.UTI = @"com.instagram.photo";
[self setupDocumentControllerWithURL:igImageHookFile];
NSURL *instagramURL = [NSURL URLWithString:@"instagram://media?id=MEDIA_ID"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
}
else {
NSLog(@"No Instagram Found");
}
}
但我收到此輸出:
2012-05-05 21:55:36.842 InstantFrame[855:707] *** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit/UIKit-1914.84/UIDocumentInteractionController.m:1094
2012-05-05 21:55:36.848 InstantFrame[855:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme (null). Only the file scheme is supported.'
的Instagram將被打開,但不輸入任何東西。
看到這個問題:http://stackoverflow.com/questions/8302593/iphone-open-in-in-sdk – Jonathan
你做了Instagram的? PLZ與我分享Instagram的部分 – Hiren
也可以嘗試這樣的回答:http://stackoverflow.com/a/5631674/2284713 使用[NSURL fileURLWithPath:urPath對於igImageHookFile爲我工作。 – weienw