ios不能获取本地图片地址解决办法
2014-10-23 14:10
405 查看
最近项目要求发送本地图片,但是网上找了很久都失败了,最后还是在一个评论上找到了解决办法
![](http://img.blog.csdn.net/20141023141216382?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxNDU0MDgyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
bbs.anychat.cn/forum.php?mod=viewthread&tid=895
bbs.anychat.cn/forum.php?mod=viewthread&tid=895
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; NSData *data = UIImagePNGRepresentation(image); //保存图片路径 NSString * DocumentsPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager createDirectoryAtPath:DocumentsPath withIntermediateDirectories:YES attributes:nil error:nil]; [fileManager createFileAtPath:[DocumentsPath stringByAppendingString:@"/image.png"] contents:data attributes:nil]; NSString *filePath = [[NSString alloc]initWithFormat:@"%@%@",DocumentsPath,@"/image.png"]; }
相关文章推荐
- react-native 在iOS上使用http链接的图片地址不显示| iOS9 & iOS10 HTTP 不能正常使用的解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- IOS 获取网络地址的html字符串 本地获取网络图片
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- ios 相册获取图片模糊解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- chrome浏览器不能显示本地图片办法解决(图片预览)
- iOS照相机获取到的图片自动旋转90度解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- iOS- 相机(摄像头)获取到的图片自动旋转90度解决办法
- iOS开发技巧之:相机获取到的图片自动旋转90度解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- iOS 开发-SDWebImage访问HTTPS站点获取图片资源失败解决办法
- phpstrom2016.1.2本地服务器不能获取$post的解决办法
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- 关于VMware 11 虚拟机不能通过DCHP获取到地址的解决办法