iOS14 之后 PHAuthorizationStatusNotDetermined保存图片一直出错

#import <PhotosUI/PhotosUI.h>

1. 14需要换新的方法

        @WeakObj(self);
        [[PHPhotoLibrary sharedPhotoLibrary]performChanges:^{
            [PHAssetChangeRequest creationRequestForAssetFromImage:theImage];
        } completionHandler:^(BOOL success, NSError * _Nullable error) {
            dispatch_sync(dispatch_get_main_queue(), ^{
                @StrongObj(self);
                 if (error != nil){
                 }else{
                 }
            });
        }];            

  

2. 下面方法你在相册权限是PHAuthorizationStatusNotDetermined, 拍照保存一直报错,但是图片还是保存成功的 , 不要使用

 UIImageWriteToSavedPhotosAlbum(theImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);


///图片保存成功或失败后的处理
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {
   if (error != nil){
     }else{
    }  ;
    
}

  

原文地址:https://www.cnblogs.com/qingzZ/p/14086277.html