MCPcopy Create free account
hub / github.com/ImGoodBai/MapGoGoGo / explainGeoError

Function explainGeoError

frontend/src/App.tsx:764–788  ·  view source on GitHub ↗
(err: GeolocationPositionError)

Source from the content-addressed store, hash-verified

762 }, [tracking]);
763
764 function explainGeoError(err: GeolocationPositionError) {
765 if (err.code === err.PERMISSION_DENIED) {
766 return {
767 message: "定位权限被 Safari 或系统拒绝,页面无法开始记录。",
768 hint:
769 "如果没有看到弹窗,通常是之前拒绝过本站或 Safari 定位被关闭。请到 iPhone 设置 > 隐私与安全性 > 定位服务,确认 Safari 网站允许定位;也可以在 Safari 地址栏左侧的 aA/网站设置里把 map.suishouai.cn 的位置权限改为允许,然后刷新页面再点开始。",
770 };
771 }
772 if (err.code === err.POSITION_UNAVAILABLE) {
773 return {
774 message: "暂时拿不到当前位置。",
775 hint: "请确认手机定位服务已开启,Safari 可以访问位置,并尽量到室外或网络信号更好的位置重试。",
776 };
777 }
778 if (err.code === err.TIMEOUT) {
779 return {
780 message: "定位请求超时。",
781 hint: "请保持页面在前台,等待几秒后重试;如果一直超时,检查 Safari 的定位权限和手机网络。",
782 };
783 }
784 return {
785 message: `定位失败:${err.message}`,
786 hint: "请检查 Safari 和系统定位权限后重试。",
787 };
788 }
789
790 async function checkLocationPermission() {
791 const permissionsApi = (navigator as any).permissions;

Callers 1

startTrackingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected