CLLocationManger sends a message to a dallocated instance

So, I have a navigation controller, I click on the view controller on it, then the second one. In the second, I start listing location updates. Good.

When I press the back button on the second view controller, I sometimes get "*** -[DistanceScreen respondsToSelector:]: message sent to deallocated instance 0x1152a0" pay attention to testing on the device itself (iPhone 4, iOS 4.2).

And the stack looks like this:

#0  0x33a69910 in ___forwarding___
#1  0x33a69860 in __forwarding_prep_0___
#2  0x343713fa in -[CLLocationManager onClientEventLocation:]
#3  0x3436f694 in -[CLLocationManager onClientEvent:supportInfo:]
#4  0x3436f80a in OnClientEvent
#5  0x3436b528 in CLClientInvokeCallback
#6  0x3436d3d2 in CLClientHandleDaemonDataLocation
#7  0x3436d518 in CLClientHandleDaemonData
#8  0x33a81404 in __CFMessagePortPerform
#9  0x33a556fe in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
#10 0x33a556c2 in __CFRunLoopDoSource1
#11 0x33a47f7c in __CFRunLoopRun
#12 0x33a47c86 in CFRunLoopRunSpecific
#13 0x33a47b8e in CFRunLoopRunInMode
#14 0x33b0e4aa in GSEventRunModal
#15 0x33b0e556 in GSEventRun
#16 0x32099328 in -[UIApplication _run]
#17 0x32096e92 in UIApplicationMain
#18 0x0000280e in main at main.m:13

Where "DistanceScreen" above is the view controller that started listening for location updates. And before you answer, here is the dealloc for DistanceScreen:

NSLog(@"DistanceScreen dealloc");
[locationManager setDelegate:nil];  
[locationManager stopUpdatingLocation];
[locationManager release];
//etc.
[super dealloc];

, , , Location Manager - ? , CLLocationManager , ???? .

+3
2

4.3, 5.0. , CLLocationManager . 5.0, iPhone 3GS 4.3.

CLLocationManager , , .

+7

, fooobar.com/questions/1779050/...

self.locationManager.delegate = nil; dealloc. , , .

, !

+3

Source: https://habr.com/ru/post/1779047/


All Articles