Get the Push-Notification list on iOS8
10,829
Its very simple try this in Xcode6:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//-- Set Notification
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)];
}
//--- your custom code
return YES;
}
Author by
Massimo Piazza
Updated on July 28, 2022Comments
-
Massimo Piazza almost 2 years
Is it possible to get the text of all the received push notifications on iOS 8?
Has anyone found something on the documentation provided by Apple?
I know that the notification list can be obtained using a bluetooth device, but I'd like to get it locally.
-
Rajesh Loganathan about 10 yearsIts correct only.. You can use this in Xcode6 Beta, Not Xcode5.1 or later.
-
Ramon about 10 yearsNope, not true. You're registering for push notifications. The above functions generate a popup that the user has to accept and return a 'push token'. This has nothing to do with any notification list. The push token can be used for pushing those notifications that you'd like to read. (Like the bluetooth watch, for example)
-
Marckaraujo almost 10 years@SVMRAJESH, it don't work using Xcode6 SDK with iOS 7.x simulator or any device with iOS 7.x
-
Nishan29 almost 10 years@SVMRAJESH , I have used the same sample code for Push Notification. I'm not receiving any Push Notifications in iOS 8.0 . Please help me out wit this issue.
-
Nishan29 almost 10 years@SVMRAJESH, I'm using the below code for the same to get the Push Token, - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { NSLog(@"My token is: %@", deviceToken); PUSH TOKEN = [[[[deviceToken description] stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""] stringByReplacingOccurrencesOfString: @" " withString: @""] ;
-
0x6A75616E over 9 yearsthis does not answer the question at all
-
jsetting32 over 9 yearsXcode is still throwing errors how do I remove them? do i use a #if-else condition? Sorry... this is probably a simple fix
-
jsetting32 over 9 years6 but I solved the issue. I had to make a preprocessor condition I guess. Idk if this is the way to do it but the errors are gone and the app now works with push notifications in ios8
-
tesmojones over 9 years@SVMRAJESH, it don't work using Xcode6 SDK 8.1 with iOS 7.x device.
-
jsetting32 over 9 yearsrestart your phone then set the time to 2 days in the future... then restart set your phone back to normal time. This is what did it for me