YZPermissionManager can help you to get access to the simple and easy to use.
Supported permissions: Notifications, Location (WhileInUse, Always), Camera, Photos, Microphone, Contacts, Reminders, Calendar.
iOS 8.0+
Check the current status of the authority:
[YZPermissionManager checkPermissionWithResource:self.permissionResource
completionHandler:^(YZPermissionStatus status) {
// do some thing
}];
Request the system permission you need
[YZPermissionManager requestPermissionWithResource:self.permissionResource agreedHandler:^{
// Continue to execute your code
} rejectedHandler:^(YZPermissionStatus status) {
[self showRejectAlertController];
}];
When the user rejects your permission application, You can use the code, go to the system settings page
NSURL *systemSettingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if([[UIApplication sharedApplication] canOpenURL:systemSettingsURL]) {
[[UIApplication sharedApplication] openURL:systemSettingsURL];
}
Just drag YZPermissionManager.h / YZPermissionManager.m
to your iOS Project.
YZPermissionManager is available under the MIT license. See the LICENSE file for more info.