Apple Watchプログラミングの作法 Extensionアプリ/Objective-C対応

通知表示(Notification) - 通知される内容

Icon comment count 0
Icon stock count 0

13.4 通知される内容

次にdidReceiveRemoteNotification:withCompletion:メソッドが、どのような情報を受け取っているのかを調べてみます。ここにもデバッグ文を入れます。

受け取ったリモート通知の中身をデバッグ出力する
- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification 
                withCompletion:(void (^)(WKUserNotificationInterfaceType))
                                                       completionHandler {
    NSLog(@"%@", remoteNotification.description);
  
    completionHandler(WKUserNotificationInterfaceTypeCustom);
}
デバッグ出力の内容
{
    aps = {
        category = myCategory;
        alert = {
            body = "Test message";
            title = "Optional title";
        };
    };
    customKey = "Use this file to define a testing payload ...";
    "WatchKit Simulator Actions" = (
        {
            identifier = firstButt

コメント

    コメントはありません