使用场景: VoIP invitations, watchOS complication updates, and file provider change notifications
支持的通知类型:PKPushType :
complication、fileProvider、voIP
与传统UserNotifications 通知不同,不支持:badges, alerts, or sounds.方式呈现给用户
PKPushCredentials:用于给app授权的push token和类型。
PKPushPayload :包含一个接收到的远程推送信息
PKPushRegistry:请求发送专门的推送通知并处理接收到的这些通知
协议 PKPushRegistryDelegate
优势:
1、如果你的应用程序没有运行,系统会在收到通知后自动启动;虽然你也可以使用无声的用户通知来更新你的应用程序,但你的应用不能保证在通知到达时启动。
2、使用runtime处理通知,甚至运行在后台时
3、可以提高电池寿命,只有当它收到一个pushkit通知时,设备才被唤醒
4、比UserNotifications 通知,能够包含更多数据
配置使用:https://help.apple.com/xcode/mac/current/#/devdfd3d04a1
更多:https://developer.apple.com/videos/play/wwdc2016/724
iOS10开始,苹果不在支持VoIP应用的后台socket长连接,需要使用苹果推荐的pushkit,降低app耗电。PushKit可以说是“准实时”的,实际上延迟在1s左右。