Push Notification device token return null

HI Everyone,


I have been on that for the past 2 days I have search everywhere and I can not wrap my head around it. No matter what I do device token is always null. That is in develepment only. I tried deleting all my provisionning profile reinstall it making new ones, Ive tried it all. read 10's of pages on Stackoverflow nothing is working.


The weird thing is that I have another app with the exact same code same settings and it works perfectly I am getting the token everytime. I went all the way to removing everything and redoing it all in the code signing settings but it just wont work. Please if anyone has any suggestions it would be great. My code has nothing to fancy and like I said it works just fine in my other app


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

([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]);

UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];

[center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert)

completionHandler:^(BOOL granted, NSError * _Nullable error) {

if (!error) {

NSLog(@"request authorization succeeded!");

id token = [[NSUserDefaults standardUserDefaults] objectForKey:@"token"];

NSLog(@"content---%@", token);

}

}];

return YES;

}

Push Notification device token return null
 
 
Q