开发者

MKMAPView not showing map

I am using follwing code to show image of the given lat lon value but it gives error

NSString*lat=latitude;
NSString*longi=longitude;


mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
mapView.mapType = MKMapTypeHybrid;mapView.mapType=MKMapTypeHybrid;

double _lat = [lat doubleValue];
double _lng = [longi doubleValue];
CLLocationCoordinate2D coord = (CLLocationCoordinate2D){_lat, _lng};
MKCoordinateSpan span = (MKC开发者_C百科oordinateSpan){0.2, 0.2};
MKCoordinateRegion region = (MKCoordinateRegion){coord, span};


[mapView setRegion:region];
[self.view addSubview:mapView];


Few questions:

  1. NSString*lat=latitude;, what is your latitute, could it be CGFloat or other type?

  2. Could you print the error message that you see?

  3. Have you use the debugger, at which line of code it crashes? I suggest place a breakpoint at the line where: NSString*lat=latitude;

  4. You need to provide more information of the error (if there is anything from the log). "Give and you will receive", thats what my mentor always teach me. Give more information, and you will receive the answer you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜