Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Its very simple try this (Xcode6 Beta only):

- (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;
}
share|improve this answer
    
So using this code I should be able to get the text of any received push notification (also from external apps), is it right? –  Massimo Piazza Jun 5 at 9:54
    
Its correct only.. You can use this in Xcode6 Beta, Not Xcode5.1 or later. –  SVMRAJESH Jun 5 at 11:15
    
Thanks a lot! I'm going to try it –  Massimo Piazza Jun 5 at 11:48
    
Nope, 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) –  Ramon yesterday
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.