获取iOS8上的推送通知列表

时间:2014-06-04 23:28:03

标签: objective-c notifications push-notification apple-push-notifications ios8

是否可以在iOS 8上获取所有收到的推送通知的文本?

有没有人在Apple提供的文档上找到了什么?

我知道可以使用蓝牙设备获取通知列表,但我想在本地获取。

1 个答案:

答案 0 :(得分:26)

在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;
}
相关问题