ios - SKMap not showing because of SKCoordinateRegion -


i have strange issue started happening recently, , cannot figure out why.

when initialise map piece of code, works perfectly:

_mapview = [[skmapview alloc] initwithframe:cgrectmake( 0.0f, 0.0f,  cgrectgetwidth(self.view.frame), cgrectgetheight(self.view.frame) )];  [self.view insertsubview:_mapview atindex:0];  _mapview.settings.rotationenabled = no; _mapview.settings.displaymode = skmapdisplaymode2d;  [skroutingservice sharedinstance].mapview = _mapview; 

but, when want zoom in specific region on map, things go funky , screen blue.

code:

[self.locationmanager startupdatinglocation]; _lattitude = self.locationmanager.location.coordinate.latitude; _longitude = self.locationmanager.location.coordinate.longitude; skcoordinateregion region; region.center = cllocationcoordinate2dmake(_latitude, _longitude); region.zoomlevel = 14; _mapview.visibleregion = region; [self.locationmanager stopupdatinglocation]; 

screenshot:

enter image description here

now, i'd mention blue screen appears on first launch. if close app , start again, map displayed (both in emulator , on real device).

i tracked piece of code causing this, , it's one:

_mapview.visibleregion = region; 

how can fix this?

probably location manager has not yet received position , gives 0,0 somewhere in front of africas coast. ocean = blue.

you need setup delegate location manager , wait positive fix on position , display region in map. in code above request location after starting location manager.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -