记录一次关于unipush的使用,此cid不属于该应用的报错问题

在这里插入图片描述
在这里插入图片描述

打一个正式包,安装后测试
(直接运行到手机调试器是没有效果的,得到的cid 会显示该cid不是属于该应用)

在dcloud后台,该真机得到的cid
在这里插入图片描述

基本代码

msgPush() {
				// 推送服务业务逻辑
				//#ifdef APP-PLUS

				// 进来时候先获取clientid存储起来,登录时候传递给后端
				//client_id
				this.$store.state.cache['client_id'] = plus.push.getClientInfo().clientid;
				// console.log(plus.push.getClientInfo().clientid)
				console.log('plus.push.getClientInfo()', plus.push.getClientInfo());

				let timer = false;
				/* 点击推送消息事件*/
				plus.push.addEventListener('click', function(msg) {

					// 点击跳转到指定路径
					clearTimeout(timer);
					timer = setTimeout(() => {
						// console.log(1111,msg);
						if (msg.payload) {
							uni.navigateTo({
								url: msg.payload
							})
						}
					}, 1500)
				});

				// 监听在线消息事件
				plus.push.addEventListener('receive', function(msg) {
					console.log("recevice:" + JSON.stringify(msg))
					// TODO
					if ("LocalMSG" == msg.payload) {} else {
						if (msg.type == 'receive') {
							var options = {
								cover: false,
								title: msg.title
							};
							plus.push.createMessage(msg.content, msg.payload, options);
						}
					}
				});
				//#endif
			},
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值