IOS-跳转到设置页

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];//跳转到系统设置也


         //检测摄像头功能是否打开
        NSString *mediaType = AVMediaTypeVideo;
        AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];
        if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied){




            [self showAlertView:@"热波间需要访问你的相机" message:@"使用手机直播,热波间需要访问你的相机权限。点击“设置”前往系统设置允许热波间访问你的相机" confirm:^(id sender) {
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
                  [self stopPlayingautoExitRoom];
            } cancel:^(id sender) {
                  [self stopPlayingautoExitRoom];
            }];

            return;


        }

//检测麦克风功能是否打开
[[AVAudioSession sharedInstance]requestRecordPermission:^(BOOL granted) {
if (!granted)
{

            [self showAlertView:@"热波间需要访问你的麦克风" message:@"使用手机直播,热波间需要访问你的麦克风权限。点击“设置”前往系统设置允许热波间访问你的麦克风" confirm:^(id sender) {
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
                  [self stopPlayingautoExitRoom];
            } cancel:^(id sender) {
                [self stopPlayingautoExitRoom];
            }];
             return ;
        }


    }];

你可能感兴趣的:(IOS-跳转到设置页)