造件师
造件师
  • 发布:2024-03-17 22:09
  • 更新:2024-03-18 08:59
  • 阅读:114

【报Bug】H5 getPushClientId报错:fail uniPush is not enabled

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows 11 专业版

HBuilderX类型: 正式

HBuilderX版本号: 3.99

浏览器平台: Chrome

浏览器版本: 122.0.6261.129

项目创建方式: HBuilderX

操作步骤:

onLoad() {
uni.getPushClientId({
success: (res) => {
console.log(res.cid);
},
fail(err) {
console.log(err)
}
})
},
报错:errMsg: "getPushClientId:fail uniPush is not enabled"

预期结果:

正常使用uniPush

实际结果:

报错:errMsg: "getPushClientId:fail uniPush is not enabled"

bug描述:

最近在学习uni-ai-chat,
看文档和代码似乎是开启了uni-push2.0,自动就会流式响应。
然而,开启了uni-push,依然没有流式响应效果,排查了一下,
直接:
onLoad() {
uni.getPushClientId({
success: (res) => {
console.log(res.cid);
},
fail(err) {
console.log(err)
}
})
},
报错:errMsg: "getPushClientId:fail uniPush is not enabled"
H5应该是支持的吧。APPID:UNI332579E

2024-03-17 22:09 负责人:无 分享
已邀请:
套马杆的套子

套马杆的套子 - 没有解决不了的问题,只有解决不完的问题

新创建的项目测试的,是可以的
1.开发者后台配置上推送,我看你配了

  1. 在项目中创建云开发环境,关联上云环境
  2. 在manifest.json中配上你代码里unipush,我看你也配了
  3. 在代码中调用,看你也调用了
  4. 检查下,appid都能对上不,然后云环境能对上不

    
    <template>  
    <view>  
    
    </view>  
    </template>  

<script>
export default {
data() {
return {

        };  
    },  
    onLoad() {  
        uni.getPushClientId({  
            success: (res) => {  
                console.log(res.cid);  
            },  
            fail(err) {  
                console.log(err)  
            }  
        })  

    },  
    methods: {  

    },  
};  

</script>

  • 造件师 (作者)

    今天到办公室,又正常了,要么是电脑 要么是网络问题,我回家再排查一下,谢谢大佬,大佬辛苦了

    2024-03-18 17:49

要回复问题请先登录注册