权限判断
- (BOOL)checkPhotoAuth
{
ALAuthorizationStatus author = [ALAssetsLibrary authorizationStatus];
if(author == ALAuthorizationStatusRestricted || author == ALAuthorizationStatusDenied){
NSError *error = [NSError errorWithDomain:@"访问相册" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"无权访问相册"}];
}
- (BOOL)checkCameraAuth
{
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied){
}
BOOL service = [CLLocationManager locationServicesEnabled];
BOOL heading = [CLLocationManager headingAvailable];
BOOL backRefresh = [CLLocationManager significantLocationChangeMonitoringAvailable];
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
if (status == kCLAuthorizationStatusRestricted || status == kCLAuthorizationStatusDenied)
{
}
系统权限scheme
// 使用此方法打开系统设置
NSURL*url=[NSURL URLWithString:@"prefs:root=WIFI"];
[[UIApplication sharedApplication] openURL:url];
关于:About — prefs:root=General&path=About
辅助功能:Accessibility — prefs:root=General&path=ACCESSIBILITY
飞行模式:Airplane Mode On — prefs:root=AIRPLANE_MODE
自动锁定:Auto-Lock — prefs:root=General&path=AUTOLOCK
亮度:Brightness — prefs:root=Brightness
蓝牙:Bluetooth — prefs:root=General&path=Bluetooth
日期:Date & Time — prefs:root=General&path=DATE_AND_TIME
视频:FaceTime — prefs:root=FACETIME
通用:General — prefs:root=General
键盘:Keyboard — prefs:root=General&path=Keyboard
iCloud登录:iCloud — prefs:root=CASTLE
语言和地区:International — prefs:root=General&path=INTERNATIONAL
定位服务:Location Services — prefs:root=LOCATION_SERVICES
音乐:Music — prefs:root=MUSIC
备忘录:Notes — prefs:root=NOTES
推送:Notification — prefs:root=NOTIFICATION
相册:Photos — prefs:root=Photos
描述文件:Profile — prefs:root=General&path=ManagedConfigurationList
还原:Reset — prefs:root=General&path=Reset
声音:Sounds — prefs:root=Sounds
系统更新:Software Update — prefs:root=General&path=SOFTWARE_UPDATE_LINK
AppStore:Store — prefs:root=STORE
墙纸:Wallpaper — prefs:root=Wallpaper
WiFi:Wi-Fi — prefs:root=WIFI
热点 — prefs:root=INTERNET_TETHERING
指定应用设置:prefs:root=应用bundleID
更多权限
#define About @"prefs:root=General&path=About"
#define Accessibility @"prefs:root=General&path=ACCESSIBILITY"
#define AirplaneModeOn @"prefs:root=AIRPLANE_MODE"
#define AutoLock @"prefs:root=General&path=AUTOLOCK"
#define Brightness @"prefs:root=Brightness"
#define Bluetooth @"prefs:root=General&path=Bluetooth"
#define DateTime @"prefs:root=General&path=DATE_AND_TIME"
#define FaceTime @"prefs:root=FACETIME"
#define General @"prefs:root=General"
#define Keyboard @"prefs:root=General&path=Keyboard"
#define iCloud @"prefs:root=CASTLE"
#define iCloudStorageBackup @"prefs:root=CASTLE&path=STORAGE_AND_BACKUP"
#define International @"prefs:root=General&path=INTERNATIONAL"
#define LocationServices @"prefs:root=LOCATION_SERVICES"
#define Music @"prefs:root=MUSIC"
#define MusicEqualizer @"prefs:root=MUSIC&path=EQ"
#define MusicVolumeLimit @"prefs:root=MUSIC&path=VolumeLimit"
#define Network @"prefs:root=General&path=Network"
#define NikeiPod @"prefs:root=NIKE_PLUS_IPOD"
#define Notes @"prefs:root=NOTES"
#define Notification @"prefs:root=NOTIFICATI*****_ID"
#define Phone @"prefs:root=Phone"
#define Photos @"prefs:root=Photos"
#define Profile @"prefs:root=General&path=ManagedConfigurationList"
#define Reset @"prefs:root=General&path=Reset"
#define Safari @"prefs:root=Safari"
#define Siri @"prefs:root=General&path=Assistant"
#define Sounds @"prefs:root=Sounds"
#define Software Update @"prefs:root=General&path=SOFTWARE_UPDATE_LINK"
#define Store @"prefs:root=STORE"
#define Twitter @"prefs:root=TWITTER"
#define Usage @"prefs:root=General&path=USAGE"
#define VPN @"prefs:root=General&path=Network/VPN"
#define Wallpaper @"prefs:root=Wallpaper"
#define WiFi @"prefs:root=WIFI"
#define Hot @"prefs:root=INTERNET_TETHERING"