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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:52:38+00:00 2026-05-19T11:52:38+00:00

I’m experiencing a strange issue with location on iPhone. It looks just crazy but

  • 0

I’m experiencing a strange issue with location on iPhone. It looks just crazy but it seems to be reproducible. In my application I use Core Location to get location data on some user actions. Usually it seems to work. But on the very first run after the app was deployed on device without previous version (doesn’t matter from XCode or via iTunes), it doesn’t work at all.
Neither
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
nor
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
are called. I don’t even get coordinates of cell towers. The only sign that GPS is working is pop up that asks to allow access to location data. If I quit application (and by quit I mean really killing it instead of just putting into background), on next run everything usually starts working just fine.

Some more details.
As I need to get locations of where user does certain actions, I use following approach:

  • I use the same shared CLLocationManager object (with kCLLocationAccuracyBest) and the same shared delegate object.
  • When user does the action, I call startUpdatingLocation and create a background thread, basically timer, but there is something more not related. It wakes up once every 15 seconds
  • I accumulate fixes received by - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
  • When background thread is waken up, it checks fixes and time. If there is a good enough fix, it stops waiting. If 1 minute time interval is exceeded, it stops waiting as well.
  • “Stops waiting” = calling some method. That method seeks for best fix among received (if any) and processes it. Also it calls stopUpdatingLocation

I don’t see any obvious flaws in that way. And moreover, the very same binary usually starts working on second start. Any ideas why? Am I going crazy?

  • 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-19T11:52:39+00:00Added an answer on May 19, 2026 at 11:52 am

    It seems that I found the answer myself. My application requires some start up preparations. The difference was that at the very first run I do some big one-time job (some big synchronization over network). This long task is done in background thread. The same thread then does “common initialization” including creation of CLLocationManager object. Of course, background thread then quickly dies leaving CLLocationManager without any RunLoop. On the second start there is no need in big synchronization and “common initialization” is performed on UI thread. Therefore CLLocationManager is running on the main RunLoop and happily delivers fixes.

    To sum up: when you create CLLocationManager object, it is vitally important to do it on right thread (or rather NSRunLoop/CFRunLoop).

    • 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 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 am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

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.