IOS 判斷相冊是否允許訪問

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

  2.     [library writeImageToSavedPhotosAlbum:p_w_picpath.CGImage orientation:p_w_picpath.p_w_picpathOrientation 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.     }];  


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章