8

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

有没有人在 Apple 提供的文档中找到一些东西?

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

4

1 回答 1

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;
}
于 2014-06-05T06:48:25.787 回答