首页 > 代码库 > IOS 判断相册是否允许访问

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.     }];  


IOS 判断相册是否允许访问