didReceiveRemoteNotification not called, iOS 10

后端 未结 8 1387
误落风尘
误落风尘 2020-11-22 08:27

In iOS 9.3, the didReceiveRemoteNotification method gets called on both of the following occasions.

1) When the push notification is received 2) When

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 08:59

    Swift 4 and IOS 12.

    While there might be multiple reasons (Already mentioned on other answers) why this issue could happen, in my personal case the solution was related to the payload when sending the push notification:

    You need to set the "content-available" key on the json payload to 1.

    e.g:

    {"aps":{"alert":"Test","content-available":1, "badge":1,"sound":"default"}}

提交回复
热议问题