蔡cai
蔡cai
  • 发布:2022-09-23 14:34
  • 更新:2022-09-28 16:14
  • 阅读:487

uniPush1.0 ios静默推送接收不到(已解决)

分类:uni-app

uniPush1.0

hbuilderx版本:3.5.3
Dcloud后台发送的静默推送可以接收到
php发送的就ios12.5.5可以接收到,ios14/15接收不到

自定义基座测试
ios有"UIBackgroundModes" : "audio"这个权限
ios离线静默推送接收不到,已经配置推送证书,profile也加了pushNotice

php代码:
php使用个推的RestAPI V2sdk也尝试过了,一样效果)

$url = $this->BaseUrl . '/push/single/cid';  
$request_id = time() . rand(10000000, 99999999);  
$data = [  
    'request_id' => (string)$request_id,  
    'settings' => [  
        'ttl' => 3600000  
    ],  

    'audience' => [  
        'cid' => [$cid]  
    ],  
    'push_message' => [  
        'transmission' => (string)$message  
    ],  
    'push_channel' => [  
        'android' =>  
            ['ups' =>  
                [  
                    'transmission' => (string)$message,  
                ]],  
        'ios' =>  
            ['aps' =>  
                [  
                    'content-available' => 1  
                ],  
                'payload'=>(string)$message  

            ]  
    ]  
];  
$res = $this->post2($url, json_encode($data));

前端代码:
在App.vue中的onLaunch执行

uni.onPushMessage((res) => {  
   console.log("onPushMessage收到推送消息:",res)  
})  
plus.push.addEventListener("receive", function(res) {  
   console.log("plus收到推送消息:",res)  
}, false);
2022-09-23 14:34 负责人:无 分享
已邀请:
蔡cai

蔡cai (作者)

Dcloud后台uniPush1.0和2.0应该都是用,uniPush2.0云服务发送的吧

蔡cai

蔡cai (作者)

后端又重新试了下sdk,解决了

该问题目前已经被锁定, 无法添加新回复