Commit 83892476 authored by yuzheng.tz's avatar yuzheng.tz

移除prefs:root=的调用,这个API已经被列为私有API,请大家注意及时升级...

parent b6f3df04
...@@ -162,12 +162,14 @@ ...@@ -162,12 +162,14 @@
_tipLabel.text = tipText; _tipLabel.text = tipText;
[self.view addSubview:_tipLabel]; [self.view addSubview:_tipLabel];
if (iOS8Later) {
_settingBtn = [UIButton buttonWithType:UIButtonTypeSystem]; _settingBtn = [UIButton buttonWithType:UIButtonTypeSystem];
[_settingBtn setTitle:self.settingBtnTitleStr forState:UIControlStateNormal]; [_settingBtn setTitle:self.settingBtnTitleStr forState:UIControlStateNormal];
_settingBtn.frame = CGRectMake(0, 180, self.view.tz_width, 44); _settingBtn.frame = CGRectMake(0, 180, self.view.tz_width, 44);
_settingBtn.titleLabel.font = [UIFont systemFontOfSize:18]; _settingBtn.titleLabel.font = [UIFont systemFontOfSize:18];
[_settingBtn addTarget:self action:@selector(settingBtnClick) forControlEvents:UIControlEventTouchUpInside]; [_settingBtn addTarget:self action:@selector(settingBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_settingBtn]; [self.view addSubview:_settingBtn];
}
_timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(observeAuthrizationStatusChange) userInfo:nil repeats:YES]; _timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(observeAuthrizationStatusChange) userInfo:nil repeats:YES];
} else { } else {
...@@ -478,18 +480,7 @@ ...@@ -478,18 +480,7 @@
} }
- (void)settingBtnClick { - (void)settingBtnClick {
if (iOS8Later) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
} else {
NSURL *privacyUrl = [NSURL URLWithString:@"prefs:root=Privacy&path=PHOTOS"];
if ([[UIApplication sharedApplication] canOpenURL:privacyUrl]) {
[[UIApplication sharedApplication] openURL:privacyUrl];
} else {
NSString *message = [NSBundle tz_localizedStringForKey:@"Can not jump to the privacy settings page, please go to the settings page by self, thank you"];
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:[NSBundle tz_localizedStringForKey:@"Sorry"] message:message delegate:nil cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"OK"] otherButtonTitles: nil];
[alert show];
}
}
} }
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
......
...@@ -536,8 +536,13 @@ static CGFloat itemMargin = 5; ...@@ -536,8 +536,13 @@ static CGFloat itemMargin = 5;
NSString *appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleDisplayName"]; NSString *appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleDisplayName"];
if (!appName) appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleName"]; if (!appName) appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleName"];
NSString *message = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Please allow %@ to access your camera in \"Settings -> Privacy -> Camera\""],appName]; NSString *message = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Please allow %@ to access your camera in \"Settings -> Privacy -> Camera\""],appName];
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:[NSBundle tz_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"Cancel"] otherButtonTitles:[NSBundle tz_localizedStringForKey:@"Setting"], nil]; if (iOS8Later) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"Cancel"] otherButtonTitles:[NSBundle tz_localizedStringForKey:@"Setting"], nil];
[alert show];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"OK"] otherButtonTitles:nil];
[alert show]; [alert show];
}
} else if (authStatus == AVAuthorizationStatusNotDetermined) { } else if (authStatus == AVAuthorizationStatusNotDetermined) {
// fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏 // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏
if (iOS7Later) { if (iOS7Later) {
...@@ -671,15 +676,6 @@ static CGFloat itemMargin = 5; ...@@ -671,15 +676,6 @@ static CGFloat itemMargin = 5;
if (buttonIndex == 1) { // 去设置界面,开启相机访问权限 if (buttonIndex == 1) { // 去设置界面,开启相机访问权限
if (iOS8Later) { if (iOS8Later) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
} else {
NSURL *privacyUrl = [NSURL URLWithString:@"prefs:root=Privacy&path=CAMERA"];
if ([[UIApplication sharedApplication] canOpenURL:privacyUrl]) {
[[UIApplication sharedApplication] openURL:privacyUrl];
} else {
NSString *message = [NSBundle tz_localizedStringForKey:@"Can not jump to the privacy settings page, please go to the settings page by self, thank you"];
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:[NSBundle tz_localizedStringForKey:@"Sorry"] message:message delegate:nil cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"OK"] otherButtonTitles: nil];
[alert show];
}
} }
} }
} }
......
...@@ -295,8 +295,13 @@ ...@@ -295,8 +295,13 @@
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if ((authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied) && iOS7Later) { if ((authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied) && iOS7Later) {
// 无相机权限 做一个友好的提示 // 无相机权限 做一个友好的提示
if (iOS8Later) {
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法使用相机" message:@"请在iPhone的""设置-隐私-相机""中允许访问相机" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil]; UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法使用相机" message:@"请在iPhone的""设置-隐私-相机""中允许访问相机" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil];
[alert show]; [alert show];
} else {
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法使用相机" message:@"请在iPhone的""设置-隐私-相机""中允许访问相机" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alert show];
}
} else if (authStatus == AVAuthorizationStatusNotDetermined) { } else if (authStatus == AVAuthorizationStatusNotDetermined) {
// fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏 // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏
if (iOS7Later) { if (iOS7Later) {
...@@ -312,9 +317,13 @@ ...@@ -312,9 +317,13 @@
} }
// 拍照之前还需要检查相册权限 // 拍照之前还需要检查相册权限
} else if ([TZImageManager authorizationStatus] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片 } else if ([TZImageManager authorizationStatus] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片
if (iOS8Later) {
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的""设置-隐私-相册""中允许访问相册" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil]; UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的""设置-隐私-相册""中允许访问相册" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil];
alert.tag = 1;
[alert show]; [alert show];
} else {
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的""设置-隐私-相册""中允许访问相册" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alert show];
}
} else if ([TZImageManager authorizationStatus] == 0) { // 未请求过相册权限 } else if ([TZImageManager authorizationStatus] == 0) { // 未请求过相册权限
[[TZImageManager manager] requestAuthorizationWithCompletion:^{ [[TZImageManager manager] requestAuthorizationWithCompletion:^{
[self takePhoto]; [self takePhoto];
...@@ -418,19 +427,6 @@ ...@@ -418,19 +427,6 @@
if (buttonIndex == 1) { // 去设置界面,开启相机访问权限 if (buttonIndex == 1) { // 去设置界面,开启相机访问权限
if (iOS8Later) { if (iOS8Later) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
} else {
NSURL *privacyUrl;
if (alertView.tag == 1) {
privacyUrl = [NSURL URLWithString:@"prefs:root=Privacy&path=PHOTOS"];
} else {
privacyUrl = [NSURL URLWithString:@"prefs:root=Privacy&path=CAMERA"];
}
if ([[UIApplication sharedApplication] canOpenURL:privacyUrl]) {
[[UIApplication sharedApplication] openURL:privacyUrl];
} else {
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"抱歉" message:@"无法跳转到隐私设置页面,请手动前往设置页面,谢谢" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
[alert show];
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment