fuzzygoat
fuzzygoat

Reputation: 26223

Separate CLLocationManager for location & heading?

I have noticed in a few books that quite often two instances of CLLocationManager are created, one for location and a separate one for heading. If you wanted a separate delegate for each I could see the point, but all the methods are unique so I can't really think of a reason for doing this. Is there something I am missing, or is it possible to simplify this and use one CCLocationManager for both location and heading?

// LOCATION
locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[customMapView setShowsUserLocation:YES];

// HEADING:
headingManager = [[CLLocationManager alloc] init];
[headingManager setDelegate: self];
[headingManager setHeadingFilter:kCLHeadingFilterNone];
[headingManager startUpdatingHeading];

Upvotes: 1

Views: 886

Answers (1)

deanWombourne
deanWombourne

Reputation: 38485

I've never done this and all my apps have worked absolutely fine - I'd just use the same one for both :)

I can't even begin to think of a reason why you would do this if the delegates were the same!

Upvotes: 1

Related Questions