PushKit使用

使用场景: VoIP invitations, watchOS complication updates, and file provider change notifications

支持的通知类型:PKPushType : 

complicationfileProvidervoIP


与传统UserNotifications 通知不同,不支持:badges, alerts, or sounds.方式呈现给用户


PKPushCredentials:用于给app授权的push token和类型。

PKPushPayload :包含一个接收到的远程推送信息

PKPushRegistry:请求发送专门的推送通知并处理接收到的这些通知

协议 PKPushRegistryDelegate


优势:

1、如果你的应用程序没有运行,系统会在收到通知后自动启动;虽然你也可以使用无声的用户通知来更新你的应用程序,但你的应用不能保证在通知到达时启动。

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/index.html#//apple_ref/doc/uid/TP40008194

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左右。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值