IOS 判断相册是否允许访问

  1. ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init];  

  2.     [library writeImageToSavedPhotosAlbum:image.CGImage orientation:image.imageOrientation completionBlock:^(NSURL *asSetUrl,NSError *error){  

  3.         if (error) {  

  4.             UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"保存图片失败"  

  5.                                                            message:@"请打开 设置-隐私-照片 来进行设置"  

  6.                                                           delegate:nil  

  7.                                                  cancelButtonTitle:@"确定"  

  8.                                                  otherButtonTitles:nil, nil];  

  9.             [alert show];  

  10.             [alert release];  

  11.         }else{  

  12.             UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"保存图片成功"  

  13.                                                            message:nil  

  14.                                                           delegate:nil  

  15.                                                  cancelButtonTitle:@"确定"  

  16.                                                  otherButtonTitles:nil, nil];  

  17.             [alert show];  

  18.             [alert release];  

  19.         }  

  20.           

  21.     }];  


郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。