控制台如果有如下打印:
You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
解决方案如下:
1.在项目的info.plist文件中添加:Required background modes->App downloads content in response to push notifications,如下图所示:
2.Product -> Target -> Capabilities -> Background Modes -> 勾选Remote notification,如下图所示