mapbox / DEPRECATED-mapbox-ios-sdk

REPLACED – use https://www.mapbox.com/ios-sdk instead
https://github.com/mapbox/mapbox-gl-native
Other
323 stars 8 forks source link

Use own tile server with MapBox SDK #618

Closed thkus closed 9 years ago

thkus commented 9 years ago

Hi there,

We've been using the MapBox SDK successfully in the past to display tiles of our own tile server. Now, since upgrading to 1.6.0 the App started crashing because of a missing access token. We resolved that by signing up and adding the default access token. Now the tiles are loading fine again but we see a warning: "Using watermarked example map ID [...]"

Since we are not using the MapBox-Tiles or API... is this an issue for us? Our App will also be published on the App Store.

bouchtaoui-dev commented 9 years ago

You can create a class that overrides RMAbstractWebMapSource and than override method - (NSURL *)URLForTile:(RMTile)tile to modify the URL for fetching tiles. See the class RMOpenStreetMapSource as an example.

Good luck.

thkus commented 9 years ago

Thanks for the reply. I mean we got it working. We are using the RMGenericMapSource and Tiles are loading just fine.

I'm just wondering if the warning, that shows up in the console, is of any concern since we are not using any MapBox (Server)API. We are fetching tiles from our very own tile server.

incanus commented 9 years ago

since upgrading to 1.6.0 the App started crashing because of a missing access token

Where is the crash? I'm guessing in RMMapboxSource, which is meant to work with the Mapbox servers. Like @andaluz says, you can create your own tile source class to use sources from elsewhere.

As for the warning, RMMapView uses an RMMapboxSource by default on setup if not initialized with one, so what are you are probably seeing is that period of time. How long do you wait before setting your own tile source @tosse?

thkus commented 9 years ago

The origin of the crash is in RMConfiguration's - (NSString *)accessToken; Probably called by RMMapboxSource, yes.

Ah okay, i wasn't aware of that since I'm using RMGenericMapSource to connect to my own tile server. Should i avoid using RMGenericMapSource then?

I'm initializing the RMMapView and then immediatly after i set the tile sources.
self.mapView = [[RMMapView alloc] initWithFrame:self.view.frame]; [self.mapView setTileSources:@[awesomeOverlayA, awesomeOverlayB]];

Svantulden commented 9 years ago

You can use the [[RMMapView alloc] initWithFrame:self.view.frame andTilesource:newTilesource]; method to avoid RMMapView from loading RMMapboxSource as default.