0

这是我在注册 azure hub 时设置的模板:

NSString* template = [NSString stringWithFormat:@"{\"aps\":{\"alert\":\"$(message)\",\"badge\":\"#(badge)\",\"url\":\"$(message)\",\"inAppMessage\":\"$(message)\" }}"];

        [hub registerTemplateWithDeviceToken:deviceToken name:@"notificationTemplate" jsonBodyTemplate:template expiryTemplate:@"0" tags:[NSSet setWithObjects:[NSString stringWithFormat:@"%@_%@", HUBNAME, token], nil]  completion:^(NSError* error) {
            if (error != nil) {
                NSLog(@"Error registering for notifications: %@", error);
            }
            else {
                NSLog(@"Registered !!");
            }
        }];  

当发件人发送通知时,我只收到徽章但没有收到通知。

4

1 回答 1

0

模板中没有title键。检查此模板并根据以下内容发送通知:

"{\"aps\":{\"alert\":\"$(message)\",\"title\":\"$(title)\",\"badge\":\"#(badge)\",\"url\":\"$(message)\",\"inAppMessage\":\"$(message)\" }}"
于 2016-06-03T17:34:33.140 回答