From 7ea53b800be1f12a871772ddfd209952c6592474 Mon Sep 17 00:00:00 2001 From: zyjhandsome Date: Sun, 12 Feb 2023 01:50:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=8A=E5=90=91=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=94=B3=E8=AF=B7=E6=8E=88=E6=9D=83=E3=80=8B=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zyjhandsome --- .../security/accesstoken-guidelines.md | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md index ff1b771dc8..c9a6502960 100644 --- a/zh-cn/application-dev/security/accesstoken-guidelines.md +++ b/zh-cn/application-dev/security/accesstoken-guidelines.md @@ -148,11 +148,14 @@ atManager.requestPermissionsFromUser(context, permissions).then((data) => { console.info(`[requestPermissions] data: ${JSON.stringify(data)}`); let grantStatus: Array = data.authResults; - if (grantStatus[0] === -1) { - // 授权失败 - } else { - // 授权成功 + let length: number = grantStatus.length; + for (let i = 0; i < length; i++) { + if (grantStatus[i] !== 0) { + // 授权失败 + return; + } } + // 授权成功 }).catch((err) => { console.error(`[requestPermissions] Failed to start request permissions. Error: ${JSON.stringify(err)}`); }) @@ -178,11 +181,14 @@ atManager.requestPermissionsFromUser(context, permissions).then((data) => { console.info(`[requestPermissions] data: ${JSON.stringify(data)}`); let grantStatus: Array = data.authResults; - if (grantStatus[0] === -1) { - // 授权失败 - } else { - // 授权成功 + let length: number = grantStatus.length; + for (let i = 0; i < length; i++) { + if (grantStatus[i] !== 0) { + // 授权失败 + return; + } } + // 授权成功 }).catch((err) => { console.error(`[requestPermissions] Failed to start request permissions. Error: ${JSON.stringify(err)}`); }) -- GitLab