Do I still need to register for Remote Notifications to enable Silent Notifications in my app?

不想你离开。 提交于 2020-01-05 02:33:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!