tt.openSetting
基础库 1.3.0 开始支持本方法。
打开设置页面,返回用户设置过的授权结果。
语法
tt.openSetting(options)
参数说明
options
为 object 类型,属性如下:
属性名 | 类型 | 默认值 | 必填 | 说明 | 最低支持版本 |
---|---|---|---|---|---|
success | Function | 否 | 接口调用成功的回调函数 | 1.3.0 | |
complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | 1.3.0 | |
fail | Function | 否 | 接口调用失败的回调函数 | 1.3.0 |
回调成功
object 类型,属性如下:
属性 | 类型 | 说明 | 最低支持版本 |
---|---|---|---|
errMsg | string | "openSetting:ok" | 1.0.0 |
authSetting | AuthSetting | 授权结果 | 1.3.0 |
回调失败
object 类型,属性如下:
属性名 | 类型 | 说明 | 最低支持版本 |
---|---|---|---|
errMsg | string | "openSetting:fail " + 详细错误信息 | 1.3.0 |
扫码体验
请使用字节宿主APP扫码
代码示例
tt.openSetting({
success: (res) => {
console.log("openSetting success");
},
fail: (err) => {
console.log("openSetting fail");
},
complete: (res) => {
console.log("openSetting complete");
},
});
Bug & Tip
- Tip:设置页面只包含用户请求过的权限。
- Tip:与
tt.getSetting
的区别是,openSetting
会打开设置页面,而getSetting
只会返回用户授权的设置信息。
点击纠错
评价此篇文档