mapbox / mapbox-annotation-extension

Framework extensions that can be used with the Mapbox Maps SDK for iOS.
ISC License
11 stars 19 forks source link

Offline Sideloading #67

Closed Tapestes closed 4 years ago

Tapestes commented 4 years ago

Ran into an issue with offline sideloading. It doesn't appear that the annotation extension framework can find sprites on the offline map, and I see error messages for the sprite lookup in the console...

Task <B9DFFF00-5671-4E15-BCAA-6298DF3432F6>.<160> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={NSUnderlyingError=0x282f69110 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, NSErrorFailingURLStringKey=https://api.mapbox.com/styles/v1/sestes/.../sprite@2x.json?

Tried explicitly adding the image to the style like so, without any luck...

func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
     if let image = UIImage(named: "aircraft-image") { 
          style.setImage(image, forName: "aircraft") 
     }

For grins, I tried the same process by adding as a layer rather than using the annotation-extension framework. Layer was able to find the sprite in the offline map no problem. Any thoughts?

Tapestes commented 4 years ago

Turns out, this is a larger issue related to MGLSymbolLayers and offline sideloading... https://github.com/mapbox/mapbox-gl-native-ios/issues/216