How to pick the image name and image from iPhone photo library in iOS

偶尔善良 提交于 2019-12-04 18:57:28

Use the Photos framework and import Photos/Photos.h

#import "Photos/Photos.h"

In your imagePickerController function add the following to get the filename of the selected image from the Photo library:

NSURL *imagePath = [editingInfo objectForKey:UIImagePickerControllerReferenceURL];
PHFetchResult *result = [PHAsset fetchAssetsWithALAssetURLs:@[imagePath] options:nil];
NSString *filename = [[result firstObject] filename];
NSLog(@"[filename ] %@", filename );

The result is like this: [filename ] IMG_0012.JPG

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!