cutting-room-floor / mapbox-gl-cocoa

OBSOLETE
74 stars 12 forks source link

disappearing style #78

Closed bvjustin closed 9 years ago

bvjustin commented 9 years ago

Noticed the following issue:

When an MGLMapView is initialized with a JSON string, then the Map has no styleURL set.

When the iOS app goes to the background, Map::stop() gets called, which calls the Map's asyncTerminate block, which clears the Map's style object.

Then, when bringing the app back to the foreground, Map::start() is called, which results in Map::prepare() getting called.

Map::prepare() attempts to load the style (because the style was reset in the asyncTerminate block when backgrounded). Because in this case the map was initialized with a JSON string (rather than read from a URL) this fails to load a style. On screen the map appears normal until the first interaction with it, and then the screen goes black.

Not an issue if you're only dealing with styles read from a bundled style, only when initializing a map from a JSON string.

incanus commented 9 years ago

Interesting, thanks for the report. This will get some reworking soon when we sync up the Cocoa API with where the underlying style API has been going lately.

ljbade commented 9 years ago

@incanus - I think the set style from JSON function is no longer supported? I removed it from Android a while ago.

incanus commented 9 years ago

It was the last time I looked, but styling needs some attention on iOS. It might be out of sync. Eventually we will move to #31 so it's typed.

ljbade commented 9 years ago

Hmm OK, I just remember someone saying that setting style JSON directly should be avoided for some reason. I recall it broke if you don't call it from the right thread.

incanus commented 9 years ago

Closing for now. Styling API is a ways off.