Advertisement

iOS开发实战——摄像头权限及相册管理优化

阅读量:

在实际开发项目中,默认情况下我们常需访问设备摄像头或相册功能。当某个应用首次被安装时,在首次启动后系统会在此时弹出授权对话框,请用户进行授权确认。由于入整体功能相对简单,在实际应用中还需对注虑相关问题但为了降低重复造率词库错误并

该博客中的示例代码已经上传至 https://github.com/chenyufeng1991/AuthorityOfCameraAndPhoto 位置处

首先我先描述一下出现的问题。我以访问相册为例,实现代码如下:

复制代码
 - (void)photoBtnPressed:(id)sender

    
 {
    
     // 首先查看当前设备是否支持相册
    
     if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
    
     {
    
     [self presentToImagePickerController:UIImagePickerControllerSourceTypePhotoLibrary];
    
     }
    
     else
    
     {
    
     [self showAlertController:@

全部评论 (0)

还没有任何评论哟~