you can register and unregister the remote notification with bellow code.
Register RemoteNotification with bellow code..means Enable notification
//-- Set Notification
if ([[UIApplication sharedApplication]respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
// For iOS 8 and above
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
// For iOS < 8
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
and Disable it with bellow code.
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…