Bronze & Silver - Completed


Hello, everyone! I thought I’d post my solution to both Silver and Bronze challenges.

[color=#444444]Bronze Challenge
Change the CLLocationManager so that it only updates its delegate with a new
location if the device has moved more than 50 meters.

Silver Challenge
Using delegation, retrieve the heading information from the
CLLocationManager and print it to the console.[/color]


[color=#008000]- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;[/color]

[code]self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {
// Location services was relocated into its own helper method.
[self startLocationStandardUpdates];
return self;[/code]

[color=#008000]- (void) locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading;[/color]

[code]// Silver Challenge - Retrieve The Heading Info. (PART 1 of 2)
// A negative accuracy values signifies “Invalid”. I simply return if that is the case
if ([newHeading headingAccuracy] < 0) {

NSLog(@"\nLocation: %@", newHeading);[/code]

[color=#008000]- (void) startLocationStandardUpdates;[/color]

[code]// Determine whether location services are available
// YES only with capable device and user provided permission

if ([CLLocationManager locationServicesEnabled]) {

if (locationManager == nil) {
    locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

//  Bronze Challenge - Set Location Update Distance to Fifty Meters.
CLLocationDistance locationUpdateDistance = 50;
[locationManager setDistanceFilter:locationUpdateDistance];

[locationManager startUpdatingLocation];

//  Silver Challenge - Retrieve The Heading Info. (PART 2 of 2)
if ([CLLocationManager headingAvailable]) {
    CLLocationDegrees headingSensitivityDegree = 5;
    [locationManager setHeadingFilter:headingSensitivityDegree];
    [locationManager startUpdatingHeading];



Thanks alot. I guess I’m just awefully tired, not beeing able to resolve the bronze challenge at this one. Embarrasing :confused: :open_mouth: