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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:14:34+00:00 2026-05-28T11:14:34+00:00

When I have location services disabled, this alert shows up twice. The first time

  • 0

When I have location services disabled, this alert shows up twice. The first time is without the location manager purpose property displayed. Immediately after that (before a button of first alert is touched), it shows again, this time with the purpose property included.

When the second alert is dismissed, the first alert is still there.

This is a little annoying, and I would expect it to be confusing to the users.

What can I do to only show it once, with the purpose property?

  • 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-28T11:14:34+00:00Added an answer on May 28, 2026 at 11:14 am

    I had both a map controller object and a location manager object instantiated in my app delegate.

    mapController = [[[MapController alloc] initWithFrame:CGRectMake(0, 0, 0, 0)] retain];
    [self restartLocationManager];
    

    However, the location manager purpose property is not set until the location manager is instantiated in this code:

    - (void) restartLocationManager {
        if (locationManager)
            [locationManager release];
    
        locationManager = [[[CLLocationManager alloc] init] retain];
        locationManager.purpose = NSLocalizedString(@"Location Service Purpose", nil);
        locationManager.distanceFilter = kCLDistanceFilterNone; 
        locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; 
        [locationManager startUpdatingLocation];
    }
    

    So this was a clue that something in the initialization of the map was triggering the first alert.

    Because I declined to turn location services on in the first alert, the map controller initialized and saw a need to show the alert. The map controller initialization is this (it is part of a singleton, and needs some cleanup in that regard, but ignoring that…):

    - (id) initWithFrame:(CGRect)aFrame {
        @synchronized(self) {
            if (!theMap) {
                if (!self) self = [super init];
    
                theMap = [[[MKMapView alloc] initWithFrame:aFrame] retain];
                theMap.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
                theMap.showsUserLocation = YES;
                theMap.delegate = self;
        }
        return self; 
    
    }
    

    Stepping through the code, I saw the second alert show up when the showUserLocation line was executed. I’ll have to do a little more testing to narrow it down exactly, but I think I’m on the right track now.

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

Sidebar

Related Questions

I have location services disabled for my application in the settings panel. I run
It's the first time I am working with the location services and I am
I have this rewrite rule RewriteEngine On RewriteBase /location/ RewriteRule ^(.+)/?$ index.php?franchise=$1 Which is
I have implemented Location Based Services using Network Location Provider it doesn't providing me
I have an iOS application that uses GPS for Location Services. A user would
I have following test class @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {/services-test-config.xml}) public class MySericeTest { @Autowired
I have a Location class which represents a location somewhere in a stream. (The
Most web applications have a Location field, in which uses may enter a Location
I have given a location defined by latitude and longitude. Now i want to
I have my current location fixed via CoreLocation. Now I want to get those

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.