|
@@ -234,8 +234,11 @@
|
|
|
[self.photoGroupView setupGroup];
|
|
|
[self delayedSetPhotoGroupViewFrameFun];
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
+ else if (status == PHAuthorizationStatusDenied || status == PHAuthorizationStatusRestricted) {
|
|
|
+ // 用户拒绝授权或设备受限,提示用户去系统设置中开启权限
|
|
|
+ [self requestPhotoLibraryAccessWithAlert];
|
|
|
+ }
|
|
|
}];
|
|
|
}
|
|
|
}
|
|
@@ -765,4 +768,30 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+#pragma mark 用户拒接授权相册
|
|
|
+- (void)requestPhotoLibraryAccessWithAlert {
|
|
|
+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"相册访问被拒绝"
|
|
|
+ message:@"为了正常使用应用功能,请允许访问您的相册。"
|
|
|
+ preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+
|
|
|
+ UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:@"去设置"
|
|
|
+ style:UIAlertActionStyleDefault
|
|
|
+ handler:^(UIAlertAction *action) {
|
|
|
+ // 打开应用的设置页面
|
|
|
+ NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
|
|
+ if ([[UIApplication sharedApplication] canOpenURL:url]) {
|
|
|
+ [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消"
|
|
|
+ style:UIAlertActionStyleCancel
|
|
|
+ handler:nil];
|
|
|
+
|
|
|
+ [alert addAction:settingsAction];
|
|
|
+ [alert addAction:cancelAction];
|
|
|
+
|
|
|
+ [self presentViewController:alert animated:YES completion:nil];
|
|
|
+}
|
|
|
+
|
|
|
@end
|