I had both a map controller object and a location manager object created in my application.
mapController = [[[MapController alloc] initWithFrame:CGRectMake(0, 0, 0, 0)] retain]; [self restartLocationManager];
However, the destination property of the location manager is not set until a location manager is created 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, that was the key to something in the map initialization causing the first warning.
Since I refused to enable location services in the first warning, the map controller initialized and saw the need to show a warning. The initialization of the card controller is as follows (it is part of the singleton mode and needs some cleaning in this regard, but ignores this ...):
- (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; }
While executing the code, I saw that the second warning appeared when the showUserLocation line was executed. I need to do a little more tests to narrow it down for sure, but I think I'm on the right track right now.
source share