Enabling Apple Push Notifications (APNS)

(Optional) Subscribe to Apple Push Notifications (APNS).

To enable APNS push notification for an iOS application:

  1. Enable the certificate for push. Use the Apple Push Notification service to propagate information from the backend to the device. Use the native iOS push services to enable APNS for iOS applications. For information on enabling certificates for APNS, see the Apple Web site at: http://developer.apple.com/xcode/
  2. Configure APNS Push using Management Cockpit on server-side to receive APNS.
  3. Exchange the device token using setConfigProperty method. Add these two methods into the AppDelegate class to fetch the device token at the client side:
    -(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData
            *)deviceToken
     {
       NSString *devToken=[[[NSString alloc]initWithData:deviceToken encoding:NSUTF8StringEncoding]autorelease];
       NSLog(@"Device Token:  %@",devToken);
     } 
    -(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
     {         
       NSLog(@"Error Occurred: %@",[error description]);
     } 
  4. After successful registration, set the device token received in didRegisterForRemoteNotificationsWithDeviceToken method using following code:
    NSError* error = nil;
    NSDictionary *props = [NSMutableDictionary dictionary];
    [props setValue:deviceToken forKey:@"d:ApnsDeviceToken"];
    [appSettings setConfigProperty:props error:&error];
       if (error) {
                NSLog(@"ERROR:  %@",error);
               }   
Related tasks
Apple Push Notifications