[英]What are the advantages / disadvantages of Bing maps over Map Kit on iOS
[英]Regarding Map Kit in iOS 6.0.1
我無法在iOS 6.0.1中獲取當前位置,![[嘗試獲取當前位置時,請查看屏幕快照,地圖視圖未顯示,僅顯示空白地圖屏幕,我當前的位置經度正確
我的代碼如下:
//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];
}
上面的代碼顯示治愈
這可能是因為iOS 6不支持
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
方法。 請檢查文檔 。 不建議使用上述方法。 在iOS 6及更高版本中,位置管理器在事件可用時將事件報告給其委托的locationManager:didUpdateLocations:
方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.