开发者

Problem with CLLocationManager in iOS Simulator

开发者 https://www.devze.com 2023-04-08 09:25 出处:网络
I try to show a location on the map, here is the code: locationManager = [[CLLocationManager alloc] init];

I try to show a location on the map, here is the code:

locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager.location initWithLatitude:latitude longitude: longitude];
NSLog(@"%f", [selectedBuilding.latitude doubleValue]);
[locationManager startUpdatingLocation];

However, no matter what coordinates 开发者_如何学GoI provide, the blue dot always locates in California which seems the default behaviour, is there anything additional I need to do? Thanks.


In simulator CLLocationManager is always in headquarters of Apple. It's from CLLocation Class reference:
coordinate
The geographical coordinate information. (read-only)

@property(readonly, nonatomic) CLLocationCoordinate2D coordinate
Discussion
When running in the simulator, Core Location assigns a fixed set of coordinate values to this property. You must run your application on an iPhone OS–based device to get real location values.

Availability
Available in iPhone OS 2.0 and later.
Declared In
CLLocation.h

0

精彩评论

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

关注公众号