调用系统相机拍照,获取图片名称

1.先保存图片到本地,之后再获取名称


ALAssetsLibrary*assetsLibrary = [selfdefaultAssetsLibrary];

//// 保存到本地

[assetsLibrarywriteImageToSavedPhotosAlbum:[imageCGImage]orientation:(ALAssetOrientation)[imageimageOrientation]completionBlock:^(NSURL*assetURL,NSError*error){

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND,0),^{

[assetsLibraryassetForURL:assetURLresultBlock:^(ALAsset*asset){//这里的asset便是我们所需要的图像对应的ALAsset了

dispatch_async(dispatch_get_main_queue(),^{

//ALAssetRepresentation *representation = [asset defaultRepresentation];

//NSString *imageName = representation.filename;

//NSLog(@"imageName:%@", imageName);

[weakSelf.selectedAssets addObject:asset];

});

}failureBlock:^(NSError*error) {

//NSLog(@"%@", [error localizedDescription]);

ALERT_VIEW(@"图像保存在本地失败,请重新拍摄");

}];

});

}];

blog.csdn.net/yuedong56/article/details/20242131

你可能感兴趣的:(调用系统相机拍照,获取图片名称)