dafeizhu
dafeizhu
  • 发布:2022-08-01 15:36
  • 更新:2022-08-16 13:32
  • 阅读:330

【报Bug】正式版3.5.3,iOS端首次打开应用运行getClientInfoAsync,无回调执行

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: windows10

HBuilderX类型: 正式

HBuilderX版本号: 3.5.3

手机系统: iOS

手机系统版本号: iOS 15

手机厂商: 苹果

手机机型: iPhone11

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

onLaunch() {
this.getPhoneClientID();
},
methods: {
getPhoneClientID() {
let cid;
// #ifdef APP-PLUS
plus.push.getClientInfoAsync(
(info) => {
cid = info.clientid;
if (cid == null) {
console.log('获取cid失败,准备重新获取');
setTimeout(() => {
this.getPhoneClientID();
}, 500);
} else {
console.log('clientid为:' + cid);
uni.setStorageSync('cid', cid);
}
},
() => {
console.log('获取cid失败,准备重新获取');
setTimeout(() => {
this.getPhoneClientID();
}, 500);
}
);
// #endif
}
}

操作步骤:

新建uniapp项目,在App.vue中粘贴上边代码

预期结果:

成功获取到clientid

实际结果:

plus.push.getClientInfoAsync无回调执行

bug描述:

最新的正式版HBx3.5.3版本,首次打开应用的onLaunch回调中运行plus.push.getClientInfoAsync,无回调执行

2022-08-01 15:36 负责人:天生DR 分享
已邀请:
DCloud_iOS_XHY

DCloud_iOS_XHY

这个方法需要网络权限,首次打开app用户还未授权吧?可以测试一下是不是这个问题

  • dafeizhu (作者)

    可一样的代码,在3.4.18版本的基座下没问题哦

    2022-08-02 08:58

天生DR

天生DR - 天生我材必有用

您好 我试了下 并没有出现你描述的情况 你的示例代码 跑完

打印了 cid

16:03:21.324  App Launch at App.vue:4   
16:03:21.349  App Show at App.vue:8   
16:03:22.333  clientid为:64134f9c5dbf926f7388xxxxxxxxxxxxxx at App.vue:35
  • dafeizhu (作者)

    你好,麻烦试试自定义基座,我这边在HB的基座也是没有问题的

    2022-08-03 09:54

  • 天生DR

    回复 d***@163.com: 你是用的unipush2.0 吗?还是原来的1.0 你可以发我一下你的UNI_ID 我这儿查一下

    2022-08-03 11:18

yyf

yyf

HBX3.5.3使用离线打包,iOS端的plus.push.getClientInfoAsync啥反应都没,android没问题,HBX直接运行到iOS设备是没问题的

  • 天生DR

    https://nativesupport.dcloud.net.cn/AppDocs/usemodule/iOSModuleConfig/push

    最上边的 plist 你看看你本地是不是没按照那个配

    2022-08-16 15:50

  • yyf

    回复 天生DR: 输错一个字母,现在可以正常获取了

    2022-08-16 17:08

  • 天生DR

    回复 yyf: 好的

    2022-08-17 12:10

要回复问题请先登录注册