由于某种原因Fitness.requestPermissions(permissions).then((authorized) => { console.log(authorized) }
总是返回false
。同样在文档中它说它permissions
应该是:
const permissions = [
{ kind: Fitness.PermissionKind.Step, access: Fitness.PermissionAccess.Read },
];
但输出console.log(Fitness.PermissionKind, Fitness.PermissionAccess)
是:
{"Activity": 2, "Calories": 3, "Distance": 1, "HeartRate": 4, "Step": 0} {"READ": 0, "WRITE": 1}
有Fitness.PermissionAccess.Read
大写键{"READ": 0, "WRITE": 1}
知道为什么Fitness.requestPermissions([{kind:0, access: 0}])
(Fitness.PermissionKind.Step 和 Fitness.PermissionAccess.READ) 总是失败吗?它确实显示了一个弹出窗口,我可以在其中选择一个帐户,但是仍然没有授予权限。