Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6128825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:40:15+00:00 2026-05-23T16:40:15+00:00

I’m working through Big Nerd Ranch’s iOS Programming, 2nd Edition , and I’ve come

  • 0

I’m working through Big Nerd Ranch’s iOS Programming, 2nd Edition, and I’ve come to the Chapter 4 Challenge: Heading. The exercise offers a hint that I’m finding confusing; it says I need to do things that I don’t think I need to do.

Up to this point in the chapter, the book has walked me through the concept of delegation, using CoreLocation as an example. In the app delegate, I’ve added a CLLocationManager instance variable and set its delegate to be the app delegate. See below:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    locationManager = [[CLLocationManager alloc] init];

    [locationManager setDelegate:self];

    [locationManager setDistanceFilter:kCLDistanceFilterNone];
    [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
    [locationManager startUpdatingLocation];

    [self.window makeKeyAndVisible];
    return YES;
}

I’ve also implemented the two delegate methods for CLLocationManager, as follows:

- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
    NSLog(@"%@", newLocation);
}

- (void)locationManager:(CLLocationManager *)manager
       didFailWithError:(NSError *)error
{
    NSLog(@"Could not find location: %@", error);
}

Ok, so the chapter has walked me through all of this so far, and everything works nicely. Now comes the exercise:

“Using delegation, retrieve the heading information from the
CLLocationManager and print it to the console. (Hint: You need to implement at least one delegate method and send another message to the
location manager.)”

Here’s where I’m confused. First of all, after reading the CLLocationManager documentation, it appears as though there are no delegate methods to be implemented other than the two I’ve already done. So I don’t know what other delegate method the hint could be referring to.

Second of all, it seems as though I could solve the exercise simply by updating the implementation of locationManager:didUpdateToLocation:fromLocation: like so:

- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
    NSLog(@"%@", newLocation);
    // Updated code below
    CLLocationDirection heading = [newLocation course];
    NSLog(@"Heading: %f", heading);
}

So it seems to me as though I don’t, in fact, need to send any more messages to the location manager (although I do need to send a getter message to newLocation; but that’s a CLLocation, not a CLLocationManager).

So I’m clearly misunderstanding something. I’m not looking for a solution—I do want to work this through—but I would very much appreciate a hint as to what I’m misunderstanding. Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:40:16+00:00Added an answer on May 23, 2026 at 4:40 pm

    I think they are asking you to get the compass (magnetic) heading.

    Look back at the CLLocationManager docs again. There are -startUpdatingHeading and -stopUpdatingHeading methods and corresponding delegate methods to get the compass heading from the device.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am trying to loop through a bunch of documents I have to put
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.