+ (COPromise *)getAlbumLastPhoto {
COPromise *promise = [COPromise promise];
//读取图片资源
PHAsset *asset = [YHPhotoHandleManager latestAsset];
[YHPhotoHandleManager getPhotoWithAsset:asset photoWidth:125 completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (photo) {
[promise fulfill:photo];
} else {
[promise fulfill:nil];
}
} progressHandler:nil networkAccessAllowed:YES];
return promise;
}
调用:
co_launch(^{
// 获取系统最近的一张照片
id result = await([YHPhotoHandleManager getAlbumLastPhoto]);
if (result) {
}
});