diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 8df08aa513ef1b91e67cc90689268cf45af5a67e..fb6f780dc22059c41583f874e9e333e0cfb52555 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -218,7 +218,13 @@ struct Index { // Obtain current location switch status and pull up the global switch to set the pop-up box. isLocationToggle(): void { let atManager = abilityAccessCtrl.createAtManager(); - let isLocationEnabled = geoLocationManager.isLocationEnabled(); + let isLocationEnabled = true; + try { + isLocationEnabled = geoLocationManager.isLocationEnabled(); + } catch (error) { + let err = error as BusinessError; + hilog.error(0x0000, 'Index', `isLocationEnabled failed, error code=${err.code}, message=${err.message}`); + } if (!isLocationEnabled) { atManager.requestGlobalSwitch(this.context, abilityAccessCtrl.SwitchType.LOCATION).then((data: boolean) => { if (data) { diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index 06b2783670a348f95533b352c1ceda909a842bbc..5bebc9755447385d82ce4138f54d991b1f85f348 100644 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "dependencies": { }, "execution": { diff --git a/oh-package.json5 b/oh-package.json5 index bb12751b97530b9a3504e56e8ed09d8c9ba1fa52..2d9c74ff34f1383ec920815a40399dd0fe46a6c5 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -1,10 +1,8 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "description": "Please describe the basic information.", "dependencies": { }, "devDependencies": { - "@ohos/hypium": "1.0.19", - "@ohos/hamock": "1.0.0" } }