Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
- if( SYSTEM_VERSION_LESS_THAN( @"10.0" ) ) {
- [[UIApplication sharedApplication] registerForRemoteNotifications];
- } else {
- UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
- center.delegate = self;
- [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error)
- {
- if( !error ) {
- [[UIApplication sharedApplication] registerForRemoteNotifications]; // required to get the app to do anything at all about push notifications
- } else {
- NSLog( @"Push registration FAILED" );
- NSLog( @"ERROR: %@ - %@", error.localizedFailureReason, error.localizedDescription );
- NSLog( @"SUGGESTIONS: %@ - %@", error.localizedRecoveryOptions, error.localizedRecoverySuggestion );
- }
- }];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement