问题
I want to send silent notifications to my users (receive in background - not alert, sound or badge). I checked the Remote Notifications option in Xcode's Background Modes.
My question is - do I still need to register for remote notifications using [UIApplication sharedApplication] registerForRemoteNotificationTypes?
If so - what type should I use? None of them looks like "Silent Notifications":
- UIRemoteNotificationTypeNone
- UIRemoteNotificationTypeBadge
- UIRemoteNotificationTypeSound
- UIRemoteNotificationTypeAlert
- UIRemoteNotificationTypeNewsstandContentAvailability
What is the correct way to do this?
回答1:
Ya you can do it:
But ask your backend developer to sent notification like following empty sound file:
{
"aps" : {
"sound" : "nothiong.cif"
}
}
It will display notification without sound.
Note: The sound file not must in App bundle.
来源:https://stackoverflow.com/questions/25721269/do-i-still-need-to-register-for-remote-notifications-to-enable-silent-notificati