这是我在注册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 !!");
}
}];
当发件人发送通知时,我只收到徽章但未收到通知。
答案 0 :(得分:0)
模板中没有title
个键。检查此模板并根据以下内容发送通知:
"{\"aps\":{\"alert\":\"$(message)\",\"title\":\"$(title)\",\"badge\":\"#(badge)\",\"url\":\"$(message)\",\"inAppMessage\":\"$(message)\" }}"