mapbox / mapbox-maps-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and Metal
https://www.mapbox.com/mapbox-mobile-sdk
Other
479 stars 156 forks source link

Panning in offline mode with terrain is stuck sometimes #1654

Open mfazekas opened 2 years ago

mfazekas commented 2 years ago

Environment

Observed behavior and steps to reproduce

https://user-images.githubusercontent.com/52435/196415778-684dec53-beee-449d-9800-d8382f313aa8.mov

Happens around 20sec of the video. The panning stuck.

Logs around there at the end of report, I do see logs for pan statement, but the pan actions are not doing anything for a while.

To reproduce start the app, press download button, wait for the download to complete, turn off wifi. And start panning in one direction.

Code used:

import UIKit
import MapboxMaps

let accessTokenSch = "pk....";

extension LocationCoordinate2D {
  func move(latitude: Double, longitude: Double) -> LocationCoordinate2D {
    return LocationCoordinate2D(latitude: self.latitude + latitude, longitude: self.longitude + longitude)
  }
}
extension Feature {
  init(geometry: Geometry, properties: JSONObject) {
    self.init(geometry:geometry)
    self.properties = properties
  }
}

class ViewController: UIViewController, GestureManagerDelegate {
  func gestureManager(_ gestureManager: MapboxMaps.GestureManager, didBegin gestureType: MapboxMaps.GestureType) {
    print("??? didBegin: \(gestureType)")
  }

  func gestureManager(_ gestureManager: MapboxMaps.GestureManager, didEnd gestureType: MapboxMaps.GestureType, willAnimate: Bool) {
    print("??? didEnd: \(gestureType) willAnimate:\(willAnimate)")
  }

  func gestureManager(_ gestureManager: MapboxMaps.GestureManager, didEndAnimatingFor gestureType: MapboxMaps.GestureType) {
    print("??? didEndAnimatingFor: \(gestureType)")
  }

  internal var mapView: MapView!

  func buildView(_ color: UIColor = UIColor.red) -> UIView {
    let view = UIView(frame: CGRect(x:0,y:0,width:40,height:40))
    view.backgroundColor = color
    return view;
  }

  let rasterDemSourceID = "mapbox-dem"

  let mapUri = StyleURI.satelliteStreets

  func addRasterDemSource(_ map: MapboxMap) {
    let sourceIdentifier = rasterDemSourceID
    var demSource = RasterDemSource()
    demSource.url = "mapbox://mapbox.mapbox-terrain-dem-v1"
    demSource.tileSize = 514
    try! map.style.addSource(demSource, id: sourceIdentifier)
  }

  func addTerrain(_ map: MapboxMap) {
    var terrain = Terrain(sourceId: rasterDemSourceID)
    terrain.exaggeration = .constant(1.5)
    try! map.style.setTerrain(terrain)
  }

  func addRasterLayer(_ map: MapboxMap) {
    let rasterLayer = try! map.style.layer(withId: "satellite", type: RasterLayer.self)
    try! map.style.updateLayer(withId: "satellite", type: RasterLayer.self) { val in
      val.visibility = .constant(.visible)
    }
//    try! map.style.addLayer(rasterLayer)
  }

  let center = LocationCoordinate2D(latitude: 43.610, longitude: -116.395)
  func bounds() -> Polygon {
    let latd = 0.1
    let longd = 0.05

    return Polygon(
      [[
        center.move(latitude: -latd, longitude: longd),
        center.move(latitude: latd, longitude: longd),
        center.move(latitude: latd, longitude: -longd),
        center.move(latitude: -latd, longitude: -longd),
        center.move(latitude: -latd, longitude: longd),
      ]]
    )
  }

  func download(_: MapboxMap) {
    let options = StylePackLoadOptions(glyphsRasterizationMode: .ideographsRasterizedLocally,
                                       metadata: ["my-key": "my-value"],
                                       acceptExpired: false)
    let tileStore = TileStore.default

    let tileRegionId = "offline-map-part-v1"

    tileStore.removeTileRegion(forId: "offline-map-part")
    tileStore.removeTileRegion(forId: tileRegionId)

    tileStore.setOptionForKey(TileStoreOptions.mapboxAccessToken, value: accessTokenSch as Any)

    let offlineManager = OfflineManager(resourceOptions: ResourceOptions(accessToken: accessTokenSch, tileStore: tileStore))

    let descriptionOptions = TilesetDescriptorOptions(styleURI: mapUri!, zoomRange: 0...13)
    let tilesetDescriptor = offlineManager.createTilesetDescriptor(for: descriptionOptions)

    let center = LocationCoordinate2D(latitude: 43.610, longitude: -116.395)

    let tileRegionLoadOptions = TileRegionLoadOptions(
      geometry: Geometry( bounds() ),
        descriptors: [tilesetDescriptor],
        acceptExpired: true)

    let tileRegionCancelable = tileStore.loadTileRegion(
        forId: tileRegionId,
        loadOptions: tileRegionLoadOptions!) { progress in
          print(" => download progress: \(progress.completedResourceCount) / \(progress.requiredResourceCount)")
    } completion: { result in
        print(" => competion: \(result)")
    }
  }

  func addLineLayer(_ map: MapboxMap, _ bounds: Polygon) {
    var source = GeoJSONSource()
    source.data = .geometry(Geometry(bounds))

    try! map.style.addSource(source, id: "bounds")
    var layer = LineLayer(id: "bounds-lines")
    layer.source = "bounds"
    layer.lineColor = .constant(StyleColor(.red))
    layer.lineWidth = .constant(2.0)

    try! map.style.addLayer(layer)
  }

  func addDownloadButton() {
    var button: UIButton = {
      var result = UIButton()
      result.setTitle("Download", for: .normal)
      result.setTitleColor(UIColor.tintColor, for: .normal)
      result.backgroundColor = UIColor.white
      return result
    }()

    button.frame = CGRect(x: 20,y: 20,width: 100,height: 100)
    button.addAction(UIAction { action in
      let mapboxMap = self.mapView.mapboxMap!
      self.download(mapboxMap)
    }, for: .touchUpInside)
    self.view.addSubview(button)
  }

  override func viewDidLoad() {
    super.viewDidLoad()

    let myResourceOptions = ResourceOptions(accessToken:accessTokenSch)
    let myMapInitOptions = MapInitOptions(resourceOptions: myResourceOptions, styleURI: mapUri)
    mapView = MapView(frame: view.bounds, mapInitOptions: myMapInitOptions)
    mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]

    self.view.addSubview(mapView)
    self.addDownloadButton()

    mapView.mapboxMap.onNext(.styleLoaded) { _ in
      let mapboxMap = self.mapView.mapboxMap!

      self.addRasterDemSource(mapboxMap)
      self.addTerrain(mapboxMap)

      self.addRasterLayer(mapboxMap)
      // self.download(mapboxMap)

      self.addLineLayer(mapboxMap, self.bounds())

      self.mapView.camera.fly(to: CameraOptions(center: self.center,
                                                zoom: 15.0,
                                                pitch: 80.0
                                               ))

      self.mapView.gestures.delegate = self
   }
  }
}

Expected behavior

Notes / preliminary analysis

Additional links and references

Logs:

2022-10-18 13:05:12.007484+0200 MapboxV10SwiftBase[1194:15167177] Connection 1394: received failure notification

...

2022-10-18 13:05:12.320419+0200 MapboxV10SwiftBase[1194:15167178] Task <3E839DF3-7696-4D29-8FFD-73A5094254EF>.<1915> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2022-10-18 13:05:12.320987+0200 MapboxV10SwiftBase[1194:15167178] Task <3E839DF3-7696-4D29-8FFD-73A5094254EF>.<1915> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x6000017a4e10 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3E839DF3-7696-4D29-8FFD-73A5094254EF>.<1915>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <3E839DF3-7696-4D29-8FFD-73A5094254EF>.<1915>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.mapbox.com/v4/mapbox.satellite/16/11583/23864@2x.png?access_token=xxx, NSErrorFailingURLKey=https://api.mapbox.com/v4/mapbox.satellite/16/11583/23864@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1}
??? didEnd: pan willAnimate:false
2022-10-18 13:05:12.333073+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 16/11583/23864=>16 for source mapbox://mapbox.satellite:
2022-10-18 13:05:12.590366+0200 MapboxV10SwiftBase[1194:15167187] Connection 1433: received failure notification

...

2022-10-18 13:05:13.388577+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 14/2896/5964=>14 for source composite:
2022-10-18 13:05:13.388763+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 14/2896/5964=>14 for source composite:
??? didBegin: pan
??? didEndAnimatingFor: pan
??? didEnd: pan willAnimate:true
2022-10-18 13:05:13.555274+0200 MapboxV10SwiftBase[1194:15167178] Connection 1477: received failure notification
2022-10-18 13:05:13.555423+0200 MapboxV10SwiftBase[1194:15167178] Connection 1477: failed to connect 1:50, reason -1
....
2022-10-18 13:05:14.490324+0200 MapboxV10SwiftBase[1194:15167183] Task <C9AFD7E6-0461-4D35-BEE8-8F0FFFB175D4>.<1978> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x6000017aa3a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <C9AFD7E6-0461-4D35-BEE8-8F0FFFB175D4>.<1978>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <C9AFD7E6-0461-4D35-BEE8-8F0FFFB175D4>.<1978>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.mapbox.com/v4/mapbox.terrain-rgb/15/5792/11928.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, NSErrorFa2022-10-18 13:05:14.490341+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 15/5790/11930=>15 for source mapbox://mapbox.terrain-rgb:
ilingURLKey=https://api.mapbox.com/v4/mapbox.terrain-rgb/15/5792/11928.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1}
2022-10-18 13:05:14.491448+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 15/5792/11928=>15 for source mapbox://mapbox.terrain-rgb:
??? didBegin: pan
2022-10-18 13:05:14.497329+0200 MapboxV10SwiftBase[1194:15167183] Connection 1496: received failure notification
2022-10-18 13:05:14.497500+0200 MapboxV10SwiftBase[1194:15167183] Connection 1496: failed to connect 1:50, reason -1

...

2022-10-18 13:05:14.578650+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 19/92661/190933=>19 for source mapbox://mapbox.satellite:
2022-10-18 13:05:14.578773+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 18/46331/95463=>18 for source mapbox://mapbox.satellite:
??? didEndAnimatingFor: pan
??? didEnd: pan willAnimate:true
2022-10-18 13:05:14.909669+0200 MapboxV10SwiftBase[1194:15167187] Connection 1500: received failure notification
2022-10-18 13:05:14.909814+0200 MapboxV10SwiftBase[1194:15167187] Connection 1500: failed to connect 1:50, reason -1

...

2022-10-18 13:05:16.127486+0200 MapboxV10SwiftBase[1194:15167187] Connection 1542: received failure notification
2022-10-18 13:05:16.127973+0200 MapboxV10SwiftBase[1194:15167187] Connection 1542: failed to connect 1:50, reason -1
??? didBegin: pan
2022-10-18 13:05:16.129337+0200 MapboxV10SwiftBase[1194:15167187] Connection 1542: encountered error(1:50)
2022-10-18 13:05:16.131421+0200 MapboxV10SwiftBase[1194:15167187] Task <82861924-086D-46D1-B9BF-9FCBDB3B58E3>.<2021> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])

...

2022-10-18 13:05:16.331800+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 16/11582/23864=>16 for source mapbox://mapbox.satellite:
2022-10-18 13:05:16.331900+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 16/11581/23864=>16 for source mapbox://mapbox.satellite:
??? didEnd: pan willAnimate:false
2022-10-18 13:05:16.611890+0200 MapboxV10SwiftBase[1194:15167178] Connection 1567: received failure notification
2022-10-18 13:05:16.612083+0200 MapboxV10SwiftBase[1194:15167178] Connection 1567: failed to connect 1:50, reason -1
2022-10-18 13:05:16.612226+0200 MapboxV10SwiftBase[1194:15167178] Connection 1567: encountered error(1:50)

...

2022-10-18 13:05:19.786577+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 12/723/1491=>12 for source composite:
2022-10-18 13:05:19.786921+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 12/723/1491=>12 for source composite:
??? didBegin: pan
2022-10-18 13:05:19.807823+0200 MapboxV10SwiftBase[1194:15167183] Connection 1618: received failure notification
2022-10-18 13:05:19.807987+0200 MapboxV10SwiftBase[1194:15167183] Connection 1618: failed to connect 1:50, reason -1

...

2022-10-18 13:05:19.855819+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 18/46331/95464=>18 for source mapbox://mapbox.satellite:
2022-10-18 13:05:19.855956+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 12/723/1488=>12 for source mapbox://mapbox.satellite:
2022-10-18 13:05:19.856003+0200 MapboxV10SwiftBase[1194:15167178] Task <2FF51A77-F61C-4B24-A5F8-CD1548A73FEF>.<2110> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x6000016cb900 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <2FF51A77-F61C-4B24-A5F8-CD1548A73FEF>.<2110>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <2FF51A77-F61C-4B24-A5F8-CD1548A73FEF>.<2110>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.mapbox.com/v4/mapbox.terrain-rgb/12/723/1488.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, NSErrorFailingURLKey=https://api.mapbox.com/v4/mapbox.terrain-rgb/12/723/1488.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1}
2022-10-18 13:05:19.856906+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 12/723/1488=>12 for source mapbox://mapbox.terrain-rgb:
??? didEnd: pan willAnimate:false
2022-10-18 13:05:20.000157+0200 MapboxV10SwiftBase[1194:15167178] Connection 1627: received failure notification
2022-10-18 13:05:20.000293+0200 MapboxV10SwiftBase[1194:15167178] Connection 1627: failed to connect 1:50, reason -1

...

2022-10-18 13:05:20.069684+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 12/723/1491=>12 for source mapbox-dem:
2022-10-18 13:05:20.069834+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 18/46328/95464=>18 for source mapbox://mapbox.satellite:
??? didBegin: pan
2022-10-18 13:05:20.593738+0200 MapboxV10SwiftBase[1194:15167178] Connection 1633: received failure notification
2022-10-18 13:05:20.593884+0200 MapboxV10SwiftBase[1194:15167178] Connection 1633: failed to connect 1:50, reason -1
2022-10-18 13:05:20.593993+0200 MapboxV10SwiftBase[1194:15167178] Connection 1633: encountered error(1:50)
??? didEndAnimatingFor: pan
??? didEnd: pan willAnimate:true
2022-10-18 13:05:20.597532+0200 MapboxV10SwiftBase[1194:15167178] Task <875102C6-0169-46C9-82BF-6240A99C52BD>.<2117> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2022-10-18 13:05:20.598115+0200 MapboxV10SwiftBase[1194:15167187] Task <875102C6-0169-46C9-82BF-6240A99C52BD>.<2117> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x600001776790 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <875102C6-0169-46C9-82BF-6240A99C52BD>.<2117>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <875102C6-0169-46C9-82BF-6240A99C52BD>.<2117>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.mapbox.com/v4/mapbox.satellite/13/1447/2981@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, NSErrorFailingURLKey=https://api.mapbox.com/v4/mapbox.satellite/13/1447/2981@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1}
2022-10-18 13:05:20.609540+0200 MapboxV10SwiftBase[1194:15167178] Connection 1634: received failure notification

...

2022-10-18 13:05:22.071458+0200 MapboxV10SwiftBase[1194:15167183] Connection 1659: failed to connect 1:50, reason -1
2022-10-18 13:05:22.071607+0200 MapboxV10SwiftBase[1194:15167183] Connection 1659: encountered error(1:50)
2022-10-18 13:05:22.073572+0200 MapboxV10SwiftBase[1194:15167183] Task <E7BEA900-0BC2-48CF-B5B9-0C21FD603D18>.<2143> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2022-10-18 13:05:22.074161+0200 MapboxV10SwiftBase[1194:15167183] Task <E7BEA900-0BC2-48CF-B5B9-0C21FD603D18>.<2143> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x60000175aca0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <E7BEA900-0BC2-48CF-B5B9-0C21FD603D18>.<2143>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <E7BEA900-0BC2-48CF-B5B9-0C21FD603D18>.<2143>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.mapbox.com/v4/mapbox.satellite/18/46328/95464@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, NSErrorFailingURLKey=https://api.mapbox.com/v4/mapbox.satellite/18/46328/95464@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1}
2022-10-18 13:05:22.075008+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 18/46328/95464=>18 for source mapbox://mapbox.satellite:
??? didBegin: pan
??? didEnd: pan willAnimate:false
2022-10-18 13:05:22.187233+0200 MapboxV10SwiftBase[1194:15167187] Connection 1660: received failure notification
2022-10-18 13:05:22.187400+0200 MapboxV10SwiftBase[1194:15167187] Connection 1660: failed to connect 1:50, reason -1
2022-10-18 13:05:22.187526+0200 MapboxV10SwiftBase[1194:15167187] Connection 1660: encountered error(1:50)

...

2022-10-18 13:05:23.130240+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 12/724/1490=>12 for source mapbox://mapbox.terrain-rgb:
2022-10-18 13:05:23.130259+0200 MapboxV10SwiftBase[1194:15167189] Task <DA8B3CBE-7C27-40C1-940C-FC917F8B5B34>.<2172> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x6000016c8600 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <DA8B3CBE-7C27-40C1-940C-FC917F8B5B34>.<2172>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <DA8B3CBE-7C27-40C1-940C-FC917F8B5B34>.<2172>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.mapbox.com/v4/mapbox.satellite/12/724/1490@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, NSErrorFailingURLKey=https://api.mapbox.com/v4/mapbox.satellite/12/724/1490@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1}
2022-10-18 13:05:23.131224+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 12/724/1490=>12 for source mapbox://mapbox.satellite:
??? didBegin: pan
??? didEnd: pan willAnimate:false
2022-10-18 13:05:23.679920+0200 MapboxV10SwiftBase[1194:15167189] Connection 1689: received failure notification
2022-10-18 13:05:23.680184+0200 MapboxV10SwiftBase[1194:15167189] Connection 1689: failed to connect 1:50, reason -1
2022-10-18 13:05:23.680331+0200 MapboxV10SwiftBase[1194:15167189] Connection 1689: encountered error(1:50)

....

2022-10-18 13:05:25.064359+0200 MapboxV10SwiftBase[1194:15167178] Task <1BFA5AB5-03F2-4AFA-9B50-1BCDCE2D738F>.<2228> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2022-10-18 13:05:25.064853+0200 MapboxV10SwiftBase[1194:15167178] Task <1BFA5AB5-03F2-4AFA-9B50-1BCDCE2D738F>.<2228> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x60000175bde0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <1BFA5AB5-03F2-4AFA-9B50-1BCDCE2D738F>.<2228>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <1BFA5AB5-03F2-4AFA-9B50-1BCDCE2D738F>.<2228>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.mapbox.com/v4/mapbox.satellite/18/46330/95466@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, NSErrorFailingURLKey=https://api.mapbox.com/v4/mapbox.satellite/18/46330/95466@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1}
2022-10-18 13:05:25.065685+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 18/46330/95466=>18 for source mapbox://mapbox.satellite:
??? didBegin: pan
2022-10-18 13:05:25.172998+0200 MapboxV10SwiftBase[1194:15167177] Connection 1745: received failure notification
2022-10-18 13:05:25.173225+0200 MapboxV10SwiftBase[1194:15167177] Connection 1745: failed to connect 1:50, reason -1
2022-10-18 13:05:25.173364+0200 MapboxV10SwiftBase[1194:15167177] Connection 1745: encountered error(1:50)

...

2022-10-18 13:05:26.423701+0200 MapboxV10SwiftBase[1194:15167187] Connection 1854: received failure notification
2022-10-18 13:05:26.423876+0200 MapboxV10SwiftBase[1194:15167187] Connection 1854: failed to connect 1:50, reason -1
2022-10-18 13:05:26.424048+0200 MapboxV10SwiftBase[1194:15167187] Connection 1854: encountered error(1:50)
??? didEndAnimatingFor: pan
??? didEnd: pan willAnimate:true
2022-10-18 13:05:26.435816+0200 MapboxV10SwiftBase[1194:15167187] Task <0BCF1491-D308-4866-91D0-376A3D38084D>.<2360> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2022-10-18 13:05:26.436405+0200 MapboxV10SwiftBase[1194:15167179] Task <0BCF1491-D308-4866-91D0-376A3D38084D>.<2360> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x6000017a0bd0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0BCF1491-D308-4866-91D0-376A3D38084D>.<2360>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <0BCF1491-D308-4866-91D0-376A3D38084D>.<2360>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.mapbox.com/v4/mapbox.satellite/18/46331/95451@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, NSErrorFailingURLKey=https://api.mapbox.com/v4/mapbox.satellite/18/46331/95451@2x.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1}
systemlevel commented 2 years ago

Seeing the same thing and it's really problematic for us. Any insights on this from Mapbox would be very appreciated as well.

astojilj commented 2 years ago

I don't think this is related to the connection issue, but could you please set RasterDem source max zoom to 14? For tile size demSource.tileSize = 514, max zoom is 14, there are no tiles at zoom level 15.

Failed to load tile 15/5790/11930=>15 for source mapbox://mapbox.terrain-rgb: ilingURLKey=https://api.mapbox.com/v4/mapbox.terrain-rgb/15/5792/11928.png?access_token=xxx&sku=100rX9NGkvY59d164eb65cc45eeeaa8d252e3769803, _kCFStreamErrorDomainKey=1} 2022-10-18 13:05:14.491448+0200 MapboxV10SwiftBase[1194:15160224] [Mapbox] [Error, maps-core]: {}[Style]: Failed to load tile 15/5792/11928=>15 for source mapbox://mapbox.terrain-rgb: ??? didBegin: pan

Is the same reproducible on Android or with mapbox-gl-js?

astojilj commented 2 years ago

@mfazekas

Could you please set maxZoom to 14, like in the Maps SDK example? https://github.com/mapbox/mapbox-maps-ios/blob/6b0e3730146930160607051f9b64294a34c9522e/Apps/Examples/Examples/All%20Examples/TerrainExample.swift#L39

Need your help in identifying the issue:

  1. the lost connection. Does this happen when connection is on (when not running offline mode)?

  2. panning slows down as camera is closer to ground and pitch changes. This issue is addressed in https://github.com/mapbox/mapbox-gl-js/pull/12280#discussion_r1008571578. This looks like the same issue - were you able to zoom out once the camera panning gets stuck?

mfazekas commented 2 years ago

@astojilj sorry for late answer,

I did add demSource.maxzoom = 14.0 but still saw the issue.

the lost connection. Does this happen when connection is on (when not running offline mode)?

No I don't see lost connection, just when testing with wifi off.

panning slows down as camera is closer to ground and pitch changes.

Yes I think this is the issue we're facing here. Yes when stuck I can zoom out then panning works again.