[英]Regarding Map Kit in iOS 6.0.1
I am not able to get my current location in iOS 6.0.1, ![Please see the screen shot when I am trying to get my current location the map view is not showing it just show blank map screen my current location latitude longitude both are correct
我无法在iOS 6.0.1中获取当前位置,![[尝试获取当前位置时,请查看屏幕快照,地图视图未显示,仅显示空白地图屏幕,我当前的位置经度正确
My code is as below:- 我的代码如下:
//Start fetching logged in user current location
self.m_LocationManager = [[CLLocationManager alloc] init];
self.m_LocationManager.distanceFilter = kCLDistanceFilterNone;
self.m_LocationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
self.m_LocationManager.delegate = self;
[self.m_LocationManager startUpdatingLocation];
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
[manager stopUpdatingLocation];
self.m_LatitudeValue = newLocation.coordinate.latitude;
self.m_LongitudeValue = newLocation.coordinate.longitude;
NSLog(@"lat %f long %f",self.m_LatitudeValue,self.m_LongitudeValue);
}
//for showing current location
- (void)addAnnotations {
MKCoordinateSpan span;
span.latitudeDelta=0.08;
span.longitudeDelta=0.08;
Social_Check_InAppDelegate *appDelegate = (Social_Check_InAppDelegate *)[[UIApplication sharedApplication] delegate];
//user current location
double latitudeValue = appDelegate.m_LatitudeValue;
double longitudeValue = appDelegate.m_LongitudeValue;
CLLocationCoordinate2D coardinate1 = {latitudeValue,longitudeValue};
MKCoordinateRegion region;
region.center=coardinate1;
region.span=span;
CSMapAnnotation *ann = [[CSMapAnnotation alloc]initWithCoordinate:coardinate1];
ann.title = m_PlacesNameString;
ann.type = @"green";
[m_MapView setRegion:region animated:TRUE];
[m_MapView regionThatFits:region];
[m_MapView addAnnotation:ann];
[ann release];
}
Above code for showing cure 上面的代码显示治愈
this is probably because iOS 6 does not support 这可能是因为iOS 6不支持
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
method. 方法。 please check the documentation .
请检查文档 。 Above method is deprecated.
不建议使用上述方法。 In iOS 6 and later, the location manager reports events to the
locationManager:didUpdateLocations:
method of its delegate when they become available. 在iOS 6及更高版本中,位置管理器在事件可用时将事件报告给其委托的
locationManager:didUpdateLocations:
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.