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{
    }  ;
    
}

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM