1

I tried registering for remote notification in the method

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

So when ever the app is lauched, it asks for remote registration everytime. According to me it should not be like this. It should if the app is already registered for it or not.

But i didn't find any method to check the think.

M i thinking right or there is some other way out?

Eran
  • 387,369
  • 54
  • 702
  • 768
Harshit Gupta
  • 1,200
  • 12
  • 27

1 Answers1

5

Try this:

+(BOOL)isHaveRegistrationForNotification{

//For ios >= 8.0
if  ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    return [[UIApplication sharedApplication] isRegisteredForRemoteNotifications];

//For ios < 8
else{ 
    UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
    BOOL deviceEnabled = !(types == UIRemoteNotificationTypeNone);
    return deviceEnabled;
    }
}