Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 访问图像路径_Iphone - Fatal编程技术网

Iphone 访问图像路径

Iphone 访问图像路径,iphone,Iphone,我想从iPhone设备中获取相册的图像路径。我还需要该图像的扩展名和名称。我没有尝试过这个,但是看看的方法,它完成了pickingMediaWithInfo方法。我认为图像的实际路径是隐藏的,但是info字典有一个名为UIImagePickerControllerReferenceURL的键,看起来它可能是原始图像的NSURL UIImagePickerControllerReferenceURL The Assets Library URL for the original version o

我想从iPhone设备中获取相册的图像路径。我还需要该图像的扩展名和名称。

我没有尝试过这个,但是看看
的方法,它完成了pickingMediaWithInfo
方法。我认为图像的实际路径是隐藏的,但是
info
字典有一个名为
UIImagePickerControllerReferenceURL
的键,看起来它可能是原始图像的NSURL

UIImagePickerControllerReferenceURL
The Assets Library URL for the original version of the picked item.
After the user edits a picked item—such as by cropping an image or trimming a movie—the URL continues to point to the original version of the picked item.
The value for this key is an NSURL object.
Available in iOS 4.1 and later.
Declared in UIImagePickerController.h

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

你能给我一些更详细的信息来找出图像的路径吗?你为什么不阅读我链接到的文档,看看我链接到的文档中的示例项目……newFilePath=[NSHomeDirectory()stringByAppendingPathComponent:textFieldNormalFile_name.text];//newFilePath=[NSTemporaryDirectory()stringByAppendingPathComponent:@“ChosenPic.jpg”];imageData=UIImageJPEG表示法(img,1.0);if(imageData!=nil){NSLog(@“HERE[%@]”,newFilePath);[imageData writeToFile:newFilePath原子:YES];}image.image=[UIImage imageNamed:newFilePath];NSLog(@“newFilePath:%@”,newFilePath);path.text=[NSString stringWithFormat:newFilePath];NSLog(@“path.text:%@”,path.text);