iOS探索之从拍照中获取图像对应的ALAsset

    if(nil == _library)

        _library = [[ALAssetsLibrary alloc] init];

    __weak __typeof__(self) weakSelf = self;

    [_library writeImageToSavedPhotosAlbum:[savedImage CGImage] orientation:(ALAssetOrientation)[savedImage imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{

            [weakSelf.library assetForURL:assetURL resultBlock:^(ALAsset *asset){//这里的asset便是我们所需要的图像对应的ALAsset了

                dispatch_async(dispatch_get_main_queue(),^{

   

                });

            }failureBlock:nil];

        });

    }];

posted on 2019-01-29 13:59  程序“猿”  阅读(440)  评论(0编辑  收藏  举报

导航