Hi,
I am getting this warning in console,
[DEBUG] {DefaultFileSource}[Database]: Unable to make space for entry
then the app is crashed with exception,
libc++abi.dylib: terminating with uncaught exception of type std::invalid_argument: Invalid offline region definition.
I know there is a seperate issue for [DEBUG] {DefaultFileSource}[Database]: Unable to make space for entry.
But i need some quick fix, please.
Thanks.
Can you provide the code that creates the offline region that causes this crash?
Hi @jfirebaugh ,
Here is the method, i am using to download offline pack,
func startOfflinePackDownload() {
let mapBound = MGLCoordinateBoundsMake(CLLocationCoordinate2D(latitude: _latSW, longitude: _lngSW), CLLocationCoordinate2D(latitude: _latNE, longitude: _lngNE))
let region = MGLTilePyramidOfflineRegion(styleURL: mapView.styleURL, bounds: mapBound, fromZoomLevel: mapView.zoomLevel, toZoomLevel: 15)
// Store some data for identification purposes alongside the downloaded resources.
let userInfo = ["name": "My Offline Pack"]
let context = NSKeyedArchiver.archivedData(withRootObject: userInfo)
// Create and register an offline pack with the shared offline storage object.
MGLOfflineStorage.shared().addPack(for: region, withContext: context) { (pack, error) in
guard error == nil else {
// The pack couldn鈥檛 be created for some reason.
print("Error")
return
}
// Start downloading.
pack!.resume()
}
}
And the code is crashing at pack!.resume(). Hey, sorry for the delay @jfirebaugh.
Thanks.
At the time of the crash, what is mapView's zoomLevel set to?
Hi @1ec5,
Initially, self.mapView.zoomLevel = 11. After zooming in to level 15 or 16 and leave the map ideal for some 5 seconds or tapping on a feature it is getting crashed.
And, it is not crashing everytime. One or two times a day.
OK, the reason I ask is that startOfflinePackDownload() creates an MGLTilePyramidOfflineRegion with a minimum zoom level of mapView.zoomLevel and a maximum zoom level of 15. The minimum zoom level must be no greater than the maximum zoom level; otherwise, an exception will be thrown. Can you verify that the minimum zoom level is correct for the offline pack?
OK, the reason I ask is that startOfflinePackDownload() creates an MGLTilePyramidOfflineRegion with a minimum zoom level of mapView.zoomLevel and a maximum zoom level of 15. The minimum zoom level must be no greater than the maximum zoom level; otherwise, an exception will be thrown. Can you verify that the minimum zoom level is correct for the offline pack?
Awesome @1ec5. Thanks you, for your reply.
Closing as a special case of #7890.
Wee I had the same issue and its just a bad thing now, because if you switch from vector-map to a satellite map, we have to zoom out and in again...
Most helpful comment
OK, the reason I ask is that
startOfflinePackDownload()creates an MGLTilePyramidOfflineRegion with a minimum zoom level ofmapView.zoomLeveland a maximum zoom level of 15. The minimum zoom level must be no greater than the maximum zoom level; otherwise, an exception will be thrown. Can you verify that the minimum zoom level is correct for the offline pack?