title: Location Services not requesting permission
body: <p>I have an odd thing going on.</p>
  
  <p><strong>FIXED: I was creating my CLLocationManager in the viewDidLoad method, so it was being cleaned by ARC almost immediately.  I changed my instance to be a class instance instead of method instance and the problem is solved.</strong></p>
  
  <p><strong>UPDATE: The view that is calling the Location Services is shown directly below.  The request to allow location services pops up then immediately fades away.</strong></p>
  
  <pre><code>    - (void)viewDidLoad
  {
      [super viewDidLoad];
      //Grab the JSON from dcJSONParser
      NSURL *mainContentURL = [NSURL URLWithString:@"http://www.andrewlarking.co.uk/DigiCons/appContent.txt"];
      dcJSONParser *mainJSONParser = [[dcJSONParser alloc]init];
      NSDictionary *mainPageDictonary = [mainJSONParser getContentFromNSURL:mainContentURL];
      //Grab the data from a specific JSON collection
      NSArray *pageOneContent = mainPageDictonary[@"firstRunPage"];
      for ( NSDictionary *pageOne in pageOneContent )
      {
          //Set the label
          self.dcEventDayViewControllerBeaconNameLabel.text = pageOne[@"title"];
      }
  
      NSLog(@"Event Day View Loaded");
  
      // Do any additional setup after loading the view.
      //  Start listening for events from the beacon manager.
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFindMint:) name:@"didLocateMint" object:nil];
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFindBlue:) name:@"didLocateBlue" object:nil];
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFindPurple:) name:@"didLocatePurple" object:nil];
  
      //Set Up the beacon manager
      dcBeaconManager *beaconManager = [[dcBeaconManager alloc]init];
      [beaconManager initBeaconManager];
  }
  </code></pre>
  
  <hr>
  
  <p>I'm using CLLocationServices but my app is not requesting permission to use Location Services.  It appears in the list, and is off by default.  I've read that permissions get stored on the device which may explain it as I've tested this app before, but testing on a new device gives the same result.</p>
  
  <p>I don't use location services straight away, the app goes through a few checks and measures before deciding to call a view that uses location services.  When it does, this is the code:</p>
  
  <pre><code>-(void)initBeacons {
     dcBeaconManager *beaconManager = [[dcBeaconManager alloc]init]; //Create an instance of the dcBeaconManager class.
      [beaconManager initBeaconManager];  //Start the beacon manager running.
  }
  </code></pre>
  
  <p>The class that calls is:</p>
  
  <pre><code>#import "dcBeaconManager.h"
  
  @implementation dcBeaconManager
  
  -(id)init
  {
      self = [super init];
      if (self != nil){}
      return self;
  }
  
  bool testRanging = true;
  bool firstRegionEntered = true;
  
  - (void)initBeaconManager {
      NSLog(@"initBeaconManager called");
      self.locationManager = [[CLLocationManager alloc] init];
      self.locationManager.delegate = self;
      NSUUID *uuid = [[NSUUID alloc]initWithUUIDString:@"B9407F30-F5F8-466E-AFF9-25556B57FE6D"];
      self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"digiConsRegion"];
      [self.locationManager startMonitoringForRegion:self.beaconRegion];
  }
  
  - (void)stopBeaconManager {
      [self.locationManager stopMonitoringForRegion:self.beaconRegion];
  }
  
  - (void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region {
      NSLog(@"Started looking for regions");
      [self.locationManager requestStateForRegion:self.beaconRegion];
  }
  
  - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
      NSLog(@"Region discovered");
      if (firstRegionEntered) {
          NSLog(@"First time in region");
          firstRegionEntered = false;
      }
      [self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
  }
  
  - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
      NSLog(@"Region left");
      [self.locationManager stopRangingBeaconsInRegion:self.beaconRegion];
  
      UILocalNotification *notification = [[UILocalNotification alloc] init];
      notification.alertBody = @"We hope you enjoyed the event, thank you for coming.";
      notification.soundName = UILocalNotificationDefaultSoundName;
      [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
  }
  
  - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region {
      NSLog(@"locationManager initiated");
      CLBeacon *beacon = [[CLBeacon alloc] init];
      beacon = [beacons lastObject];
      //Store some information about this beacon
      NSNumber *currentBeaconMajor = beacon.major;  //it's major (group) number
      NSNumber *currentBeaconMinor = beacon.minor;  //it's minor (individual) number
  
      if (([currentBeaconMinor floatValue] == 59204) &amp;&amp; ([currentBeaconMajor floatValue] == 33995) &amp;&amp; (beacon.proximity == CLProximityNear)) {
          NSLog(@"Mint discovered");
          [[NSNotificationCenter defaultCenter] postNotificationName:@"didLocateMint" object:nil];
      } else if (([currentBeaconMinor floatValue] == 7451) &amp;&amp; ([currentBeaconMajor floatValue] == 63627) &amp;&amp; (beacon.proximity == CLProximityNear)) {
          NSLog(@"Blue discovered");
          [[NSNotificationCenter defaultCenter] postNotificationName:@"didLocateBlue" object:nil];
      } else if (([currentBeaconMinor floatValue] == 51657) &amp;&amp; ([currentBeaconMajor floatValue] == 26976) &amp;&amp; (beacon.proximity == CLProximityNear)) {
          NSLog(@"Purple discovered");
          [[NSNotificationCenter defaultCenter] postNotificationName:@"didLocatePurple" object:nil];
      }
  
  }
  
  
  - (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region {
      if (testRanging) {
          NSLog(@"Testing: forced ranging");
          if ([region isEqual:self.beaconRegion] &amp;&amp; state == CLRegionStateInside) {
              [_locationManager startRangingBeaconsInRegion:(CLBeaconRegion *)region];
          }
      }
  }
  
  @end
  </code></pre>
  
  <p>None of the delegate methods get called, Malloc wondered about the Location Services initially so I've looked around and found the above peculiar error.</p>
  
  <p>Any thoughts?  I'm happy to share the entire project.</p>
  
  <p>Cheers.</p>