Mapbox - 无法解析图块集描述符:加载请求已取消

问题描述 投票:0回答:1

我有以下用于下载地图区域的代码。该函数在多个区域上异步调用。在调试/开发模式下我很少收到此错误。但在生产版本应用程序中,我有时会遇到此问题,并且整个离线用户体验都被破坏了。请注意,对于用户和字段,相同的函数用于下载区域,但主要针对字段而不是用户失败。

const downloadPack = async (packName, bounds) => {
  console.log("bounds", packName, bounds);

  // Delete old pack
  await MapboxGL.offlineManager.deletePack(packName);

  const progressListener = (offlineRegion, status) => {
    if (status.state === "complete") {
      console.log(
        `Pack: ${packName}`,
        formatBytes(status.completedResourceSize),
        status.percentage,
        status.state,
      );
    }
  };

  const errorListener = (offlineRegion, err) => {
    console.log("pack error", offlineRegion, err);
  };

  const packConfig = {
    name: packName,
    styleURL: styleURL,
    minZoom: MAP_CONFIG.MIN_ZOOM_ALLOWED,
    maxZoom: MAP_CONFIG.MAX_ZOOM_ALLOWED,
    bounds,
  };

  await MapboxGL.offlineManager.createPack(
    packConfig,
    progressListener,
    errorListener,
  );

  // console.log("packConfig", packConfig);
};

我在以下区域收到以下错误:

地区:

 LOG  bounds field-region-74 [[67.05473691050432, 24.859774187835313], [67.05879400202377, 24.864996599470516]]
 LOG  bounds field-region-73 [[67.05603555964123, 24.863974062407152], [67.06011966003771, 24.86902696726922]]
 LOG  bounds field-region-72 [[67.05860259878298, 24.868365914318616], [67.06177770104551, 24.871585472853567]]
 LOG  bounds field-region-71 [[67.0527601437771, 24.865385527088804], [67.06248793623786, 24.878936670953124]]
 LOG  bounds field-region-70 [[67.0575708775574, 24.859917106865936], [67.06827409941002, 24.868984873055723]]

错误:

 LOG  pack error {"pack":{"metadata":"{\n  \"name\" : \"field-region-74\"\n}","bounds":"{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.05473691050432,24.859774187835313]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.05879400202377,24.864996599470516]}}]}"},"_metadata":null} {"message":"Failed to resolve tileset descriptors: Loading request canceled","name":"field-region-74"}

 LOG  pack error {"pack":{"metadata":"{\n  \"name\" : \"field-region-73\"\n}","bounds":"{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.05603555964123,24.863974062407152]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.06011966003771,24.86902696726922]}}]}"},"_metadata":null} {"name":"field-region-73","message":"Failed to resolve tileset descriptors: Loading request canceled"}

 LOG  pack error {"pack":{"metadata":"{\n  \"name\" : \"field-region-72\"\n}","bounds":"{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.05860259878298,24.868365914318616]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.06177770104551,24.871585472853567]}}]}"},"_metadata":null} {"name":"field-region-72","message":"Failed to resolve tileset descriptors: Loading request canceled"}

 LOG  pack error {"pack":{"metadata":"{\n  \"name\" : \"field-region-71\"\n}","bounds":"{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.0527601437771,24.865385527088804]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.06248793623786,24.878936670953124]}}]}"},"_metadata":null} {"name":"field-region-71","message":"Failed to resolve tileset descriptors: Loading request canceled"}
 
 LOG  Pack: field-region-70 2.18 MB 100 complete

注意最后一个包已成功下载。我什至尝试等待函数使它们同步,但我仍然收到错误。

react-native mapbox mapbox-gl mapbox-android mapbox-ios
1个回答
-1
投票

您找到该线程的解决方案了吗?

我遇到了同样的错误,但我不知道为什么

© www.soinside.com 2019 - 2024. All rights reserved.