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

  • Home
  • SEARCH
  • 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 7831487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:45:18+00:00 2026-06-02T11:45:18+00:00

Working on a tutorial with CLLocationManager where I set the delegate within the init

  • 0

Working on a tutorial with CLLocationManager where I set the delegate within the init method:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

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

Set the delegate:

[locationManager setDelegate:self];

In another tutorial I set the delegate in a header file:

@interface MyViewController : UIViewController <CLLocationManagerDelegate>

Are they equal? Whats the difference (if there is one)?

  • 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-06-02T11:45:20+00:00Added an answer on June 2, 2026 at 11:45 am

    You will need both of them if you want to implement and get callbacks from the delegate of CLLocationManger

    You specify this in the header

    @interface MyViewController : UIViewController <CLLocationManagerDelegate>
    

    This tells xcode that MyViewController will implement the CLLocationManagerDelegate methods. If there are non-optional delegate methods, xcode will remind you to implement them.

    With the line below

    [locationManager setDelegate:self];
    

    You tell your instance of CLLocationManager (locationManager) that MyViewController (self) will be the delegate and it should call all the implemented CLLocationManagerDelegate methods that you have implemented (if needed)

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

Sidebar

Related Questions

Currently working through a tutorial on JOX included within Sams Teach Yourself JavaServer Pages
I am working through this tutorial book and have set up my heroku account
I'm very new to backbone but I manage to get it working from tutorial.
I'm working on this tutorial , which shows how to create an app with
PHP beginner working from a tutorial. I'm trying to do a simple upload from
I am working through this tutorial https://developers.google.com/cloud-print/docs/android for google cloud print. I am trying
I am currently working through this tutorial: Getting Started with jQuery For the two
I have been working through the tutorial adapting it to a project I want
I am having no luck getting NLog to work. Working through the tutorial ,
I'm working through an iPhone tutorial ( link text and it has me put

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.