@@ -17,7 +17,7 @@ + (BOOL)checkPhotoLibraryAuthorizationStatus
1717 ALAuthorizationStatus authStatus = [ALAssetsLibrary authorizationStatus ];
1818 if (ALAuthorizationStatusDenied == authStatus ||
1919 ALAuthorizationStatusRestricted == authStatus) {
20- kTipAlert ( @" 请在iPhone的“设置->隐私->照片”中打开本应用的访问权限" ) ;
20+ [ self showSettingAlertStr: @" 请在iPhone的“设置->隐私->照片”中打开本应用的访问权限" ] ;
2121 return NO ;
2222 }
2323 }
@@ -35,12 +35,33 @@ + (BOOL)checkCameraAuthorizationStatus
3535 AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType: AVMediaTypeVideo];
3636 if (AVAuthorizationStatusDenied == authStatus ||
3737 AVAuthorizationStatusRestricted == authStatus) {
38- kTipAlert ( @" 请在iPhone的“设置->隐私->相机”中打开本应用的访问权限" ) ;
38+ [ self showSettingAlertStr: @" 请在iPhone的“设置->隐私->相机”中打开本应用的访问权限" ] ;
3939 return NO ;
4040 }
4141 }
4242
4343 return YES ;
4444}
4545
46+ + (void )showSettingAlertStr : (NSString *)tipStr {
47+ // iOS8+系统下可跳转到‘设置’页面,否则只弹出提示窗即可
48+ if (floor (NSFoundationVersionNumber ) > NSFoundationVersionNumber_iOS_7_1) {
49+ UIAlertView *alertView = [UIAlertView bk_alertViewWithTitle: @" 提示" message: tipStr];
50+ [alertView bk_setCancelButtonWithTitle: @" 取消" handler: nil ];
51+ [alertView bk_addButtonWithTitle: @" 设置" handler: nil ];
52+ [alertView bk_setDidDismissBlock: ^(UIAlertView *alert, NSInteger index) {
53+ if (index == 1 ) {
54+ UIApplication *app = [UIApplication sharedApplication ];
55+ NSURL *settingsURL = [NSURL URLWithString: UIApplicationOpenSettingsURLString];
56+ if ([app canOpenURL: settingsURL]) {
57+ [app openURL: settingsURL];
58+ }
59+ }
60+ }];
61+ [alertView show ];
62+ }else {
63+ kTipAlert (@" %@ " , tipStr);
64+ }
65+ }
66+
4667@end
0 commit comments