获取iOS8上的推送通知列表

Mas*_*zza 8 notifications objective-c push-notification apple-push-notifications ios8

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

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

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

Raj*_*han 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;
}
Run Code Online (Sandbox Code Playgroud)

  • 不,不是真的.您正在注册推送通知.上述函数生成一个用户必须接受并返回"推送令牌"的弹出窗口.这与任何通知列表无关.推送令牌可用于推送您想要阅读的通知.(例如蓝牙手表) (3认同)