PUSH NOTIFICATION METHODS…..

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)

    {

        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound |UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

        [[UIApplication sharedApplication] registerForRemoteNotifications];

    }

    else

    {

        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:

         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];

    }

– (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

{

NSLog(@”%@”,[error description]);

 

}

– (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

{

strDeviceToken=[[[deviceToken description]

                     stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@”<>”]]

                    stringByReplacingOccurrencesOfString:@” ” withString:@””];

    

    

    NSLog(@”%@”,strDeviceToken);

    

    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

    

    [prefs setObject:strDeviceToken forKey:token1];

    

    [prefs synchronize];

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s