swift-判断是否已获得相机、相册权限

来源:互联网 发布:java axis2 调用wsdl 编辑:程序博客网 时间:2024/06/05 21:59

// 相机权限

func isRightCamera() -> Bool {

    let authStatus =AVCaptureDevice.authorizationStatus(forMediaType:AVMediaTypeVideo)

    return authStatus != .restricted&& authStatus != .denied

}


// 相册权限

func isRightPhoto() -> Bool {

    let authStatus =ALAssetsLibrary.authorizationStatus()

    return authStatus != .restricted&& authStatus != .denied

}


阅读全文
0 0
原创粉丝点击