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 6053269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:01:17+00:00 2026-05-23T08:01:17+00:00

Is it possible to start / stop location updates from the UI of the

  • 0

Is it possible to start / stop location updates from the UI of the iphone? All I need from the app is to show me my location unless I click “stop” and then “start” again.

I can’t seem to be able to do that…I have my location displayed properly, and I also created two IBButtons and created a function for each of them, however, my app crashes when I click on each one of those buttons. I placed those functions under the viewcontroller.m.

I am kind of new to this, so any help would be appreciated. Thanks!

  • (IBAction)startUpdating: (CLLocation *)location
    {

    [location startUpdatingLocation];

    }

  • (IBAction)stopUpdating: (CLLocation *)location
    {

    [location stopUpdatingLocation];

    }

  • 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-23T08:01:17+00:00Added an answer on May 23, 2026 at 8:01 am

    start/stopUpdatingLocation are CLLocationManager instance methods, rather than CLLocation instance methods… so create a CLLocationManager instance.

    .h

    @interface someClass:somesuperclass{
    CLLocationManager * locationManager;
    BOOL updating;
    }
    -(IBAction)toggleUpdating:(id)sender;
    
    @end
    

    .m somewhere in the view load/ or init cycle:

    -(void)viewDidLoad{
      [super viewDidLoad];
      locationManager = [[CLLocationManager alloc] init];
     }
     -(void)viewDidUnload{
     [locationManager stopUpdatingLocation];
     [locationManager release];
     [super viewDidUnload];
     }
    
    -(IBAction)toggleUpdating:(id)sender
    {
         if(!updating)
         {
             [locationManager startUpdatingLocation];
         }else{
             [locationManager stopUpdatingLocation];
         }
         updating = !updating;
    }
    

    also your action above will never work, because the thing after a colon in an action will be the object that sent the action, a UIButton in your case.

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

Sidebar

Related Questions

Is it possible to start and stop a commandline program from php (on the
Is is it possible to, from a desktop program, start or stop an application
Is it possible to start service without starting application? I need to refresh data
Is it possible to start an event when an UIWebView (Iphone) has finished loading
Is it possible to start JProgressBar from inbetween.I know this is wierd but I
Is it possible for a programmer to programmatically start/stop the garbage collection in C#
How can we start/stop a Windows Service from Java? For example, I would like
I am using the cargo-maven2-plugin to start and stop a tomcat container from my
'lo all. I am in the ending portion of my app for the iPhone
Possible Duplicate: C# start Windows Service programmatically I want to start/stop a preexisting windows

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.