2
我使用这个方法来进行屏幕捕获:如何从照片库中获取最后一张照片的路径?
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage*theImage=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(theImage, nil, nil, nil);
,我想获得路径那张照片,所以我可以用Instagram的方法使用它
NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", lastphotoTaken]];
// NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", lastphotoTaken]];
self.dic.UTI = @"com.instagram.exclusivegram";
self.dic = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];
[self.dic presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
感谢名单
感谢,但我的图片的网址是:'资产库://asset/asset.JPG ID = 7D636703-8786-465D-B896-A0A67F0B0CCE及EXT = JPG'如何转换它以这种方式'文件:// ...' – AsimNet
@AsimNet:你不能用资产网址来做到这一点。或者将图像存储到文档目录而不是photolibrary –