IOS 判断相册是否允许访问

  1. -(void)savedLibrayImage:(UIImage *)image  
  2. {  
  3.     ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init];  
  4.     [library writeImageToSavedPhotosAlbum:image.CGImage orientation:image.imageOrientation completionBlock:^(NSURL *asSetUrl,NSError *error){  
  5.         if (error) {  
  6.             UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"存储失败"  
  7.                                                            message:@"请打开 设置-隐私-照片 来进行设置"  
  8.                                                           delegate:nil  
  9.                                                  cancelButtonTitle:@"确定"  
  10.                                                  otherButtonTitles:nil, nil];  
  11.             [alert show];  
  12.             [alert release];  
  13.         }else{  
  14.             UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"存储成功"  
  15.                                                            message:nil  
  16.                                                           delegate:nil  
  17.                                                  cancelButtonTitle:@"确定"  
  18.                                                  otherButtonTitles:nil, nil];  
  19.             [alert show];  
  20.             [alert release];  
  21.         }  
  22.           
  23.     }];  
  24. }  

猜你喜欢

转载自huqiji.iteye.com/blog/2219114