CloudKitAtlas/AAPLAppDelegate.m

/*
 Copyright (C) 2014 Apple Inc. All Rights Reserved.
 See LICENSE.txt for this sample’s licensing information
 
 Abstract:
 
  This is the main application delegate.
  
*/
 
#import "AAPLAppDelegate.h"
 
@implementation AAPLAppDelegate
 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Register for push notifications
    UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert categories:nil];
    [application registerUserNotificationSettings:notificationSettings];
    [application registerForRemoteNotifications];
    
    return YES;
}
 
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    NSLog(@"Registered for Push notifications with token: %@", deviceToken);
}
 
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
    NSLog(@"Push subscription failed");
}
 
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)info {
    NSLog(@"Push received with alert body: %@", info[@"aps"][@"alert"]);
}
 
@end