8

iOS 8 で受信したすべてのプッシュ通知のテキストを取得することは可能ですか?

Apple が提供するドキュメントで何かを見つけた人はいますか?

Bluetooth デバイスを使用して通知リストを取得できることは知っていますが、ローカルで取得したいと考えています。

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 に答える