iOSアルバム権限、カメラ権限、マイク権限
iOS 8の後にPhotoKitが加わり、使用には
#import
が必要です
typedef NS_ENUM(NSInteger, PHAuthorizationStatus) { PHAuthorizationStatusNotDetermined = 0, //
PHAuthorizationStatusRestricted, // ,
PHAuthorizationStatusDenied, // ,
PHAuthorizationStatusAuthorized//
}
PHAuthorizationStatus photoAuthStatus = [PHPhotoLibrary authorizationStatus]; if (photoAuthStatus == PHAuthorizationStatusNotDetermined) {//
}else if(photoAuthStatus == PHAuthorizationStatusRestricted || photoAuthStatus == PHAuthorizationStatusDenied) {//
}else{//
}
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
if (status == PHAuthorizationStatusAuthorized) {
//
}else {
//
}
まず
#import
次カメラ対応AVMediaTypeVideo
マイク対応AVMediaTypeAudio
typedef NS_ENUM(NSInteger, AVAuthorizationStatus) { AVAuthorizationStatusNotDetermined = 0,//
AVAuthorizationStatusRestricted,// ,
AVAuthorizationStatusDenied,// ,
AVAuthorizationStatusAuthorized//
}
AVAuthorizationStatus videoAuthStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; if (videoAuthStatus == AVAuthorizationStatusNotDetermined) {//
}else if(videoAuthStatus == AVAuthorizationStatusRestricted || videoAuthStatus == AVAuthorizationStatusDenied) {//
}else{//
}
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if (granted){// }else {//
}
}];