我需要从 iphone 图库上传一张图片,但我没有得到所选择图片的路径(使用图片选择器)
在图像选择器委托方法中,我正在执行以下操作
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSString *strImagePath = [info valueForKey:UIImagePickerControllerReferenceURL];
NSString *strImagePath1 = [info valueForKey:UIImagePickerControllerMediaURL];
NSLog(@"%@",strImagePath);
NSLog(@"%@",strImagePath1);
NSLog(@"%@",info);
}
并且信息字典包含以下键值
{
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerOriginalImage = "<UIImage: 0x16adc0>";
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.PNG?id=1000000153&ext=PNG";
}
我使用键 UIImagePickerControllerReferenceURL 的值作为将其上传到 FTP 的图像路径,但我无法上传文件,可能我采用的路径不正确。
任何人都可以帮助我如何使用图像选择器获取拾取图像的实际路径