Azure推送通知未显示

时间:2016-06-03 07:08:49

标签: ios iphone azure apple-push-notifications azure-hub

这是我在注册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 !!");
            }
        }];  

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

1 个答案:

答案 0 :(得分:0)

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

"{\"aps\":{\"alert\":\"$(message)\",\"title\":\"$(title)\",\"badge\":\"#(badge)\",\"url\":\"$(message)\",\"inAppMessage\":\"$(message)\" }}"