You need to enable JavaScript to run this app. 基于Linphone SDK的iOS推送通知配置及回调问题咨询
优惠活动
大模型
产品
解决方案
定价
更多

基于Linphone SDK的iOS推送通知配置及回调问题咨询

Linphone iOS 推送通知配置问题解答

问题1:设置mCore.pushNotificationsEnabled = true后,是否无需自定义PushRegistry?还需补充配置吗?

  • 设置mCore.pushNotificationsEnabled = true后,Linphone SDK会自动处理PushKit的注册流程,不需要手动编写自定义PushRegistry。
  • 必须补充的配置:
    1. 在Xcode项目的Capabilities中开启Push Notifications和Voice over IP权限;
    2. 确保Apple开发者账号已配置有效的VoIP推送证书;
    3. 实现CoreDelegate协议,用于接收推送相关回调;
    4. Core初始化完成后,调用core.setPushNotificationToken(_:type:)方法传入设备的VoIP推送token,token类型指定为.VoIP。

问题2:找不到onPushNotificationReceived(core: Core, payload: String)回调函数,也不知道怎么调用?

这个方法是CoreDelegate协议中的回调,需要按以下步骤配置才能使用:

  1. 让你的类(如Core管理类或AppDelegate)遵循CoreDelegate协议:
    class CoreManager: CoreDelegate {
        // 类内部逻辑
    }
    
  2. 初始化Core时,将当前类设置为Core的代理:
    core.addDelegate(self)
    
  3. 实现回调方法:
    func onPushNotificationReceived(core: Core, payload: String) {
        // 处理来电唤醒、UI展示等逻辑
    }
    
  4. 系统收到VoIP推送时,在PushKit的didReceiveIncomingPushWith回调中,将推送payload转为字符串,调用core.processPushNotification(payload:),SDK会自动触发onPushNotificationReceived回调。

问题3:如果无法自定义PushRegistry,onPushNotificationReceived所需的payload包含哪些内容?需要附带注册数据吗?

  • 必备的payload内容(Linphone标准格式):
    • call_id:来电的唯一标识;
    • from:来电方的SIP地址;
    • to:接收方的SIP地址;
    • pn_type:固定为voip,标识推送类型;
    • 可选字段:pn_version、sound等。
  • 不需要附带设备注册数据(如推送token),Linphone服务器在你注册token时已关联用户信息,推送时会直接发送符合格式的payload到目标设备。

内容的提问来源于stack exchange,提问作者steind.VY

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 16:05:11