title: Core data object gets corrupted after calling requestAlwaysAuthorization
body: <p>I have a problem.</p>
  
  <p>I have a ViewController wherein I have a property that's a subclass of NSManagedObject. In the same viewController, in the viewDidAppear method, I call the new requestAlwaysAuthorization method on a CLLocationManager object because I need to use the GPS. My issue is that after the user has allowed me to use the device location, the core data object (the NSManagedObject) has all nil fields.</p>
  
  <p>I've tested removing my [_locationManager requestAlwaysAuthorization]; line and that results in non-corrupted NSManagedObject but then again I can't use location on iOS8+ if I skip this line!</p>
  
  <p>I'm using the Magical Records library to handle core data but I can't see how that could be a factor here.</p>
  
  <p>Does anybody have any idea what might be going on?</p>
  
  <p>EDIT: code</p>
  
  <p>In the .h file of my viewController (VC) I have</p>
  
  <pre><code>@property (strong, nonatomic) CDMission *mission;
  </code></pre>
  
  <p>and in the .m file of the same VC I have:</p>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated {
      [super viewDidAppear:animated];
      [[LocationTracker sharedTracker] wakeUpLocationManager];
  }
  </code></pre>
  
  <p>The important methods in the LocationTracker class look like this:</p>
  
  <pre><code>+ (instancetype)sharedTracker {
      static LocationTracker *sharedTracker = nil;
      static dispatch_once_t onceToken;
      dispatch_once(&amp;onceToken, ^{
          sharedTracker = [[self alloc] init];
      });
      return sharedTracker;
  }
  
  # pragma mark - Getters and setters
  - (CLLocationManager *)locationManager {
      if (!_locationManager) {
          _locationManager = [[CLLocationManager alloc] init];
          if ([_locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
             [_locationManager requestAlwaysAuthorization];
          }
          _locationManager.activityType = CLActivityTypeFitness;
          _locationManager.pausesLocationUpdatesAutomatically = YES;
          _locationManager.delegate = self;
          _locationManager.desiredAccuracy = kCLLocationAccuracyBest;
      }
      return _locationManager;
  }
  
  - (void)wakeUpLocationManager {
      [self locationManager];
  }
  </code></pre>
  
  <p>when I put a break point in viewDidAppear I can see how my CDMission object (that's my NSManagedObject) is fine but when I press a button after allowing location and put a breakpoint in the button's selector I see how my object is messed up.</p>
  
  <p>Second edit:
  The CDMission object that is a property in my VC is passed into the VC from another viewcontroller. Thus, there is no core data code relevant to my issue. It's just that the NSManagedObject CDMission becomes corrupted after the user answers the permission question for the location.</p>