开发者

Crash when app enters foreground - because delegate = self?

开发者 https://www.devze.com 2023-03-05 16:52 出处:网络
my app is occassionaly crashing when it enters开发者_如何学Python the foreground. It doesn\'t always happen, but I think I\'ve managed to isolate what is causing it. I am using this line:

my app is occassionaly crashing when it enters开发者_如何学Python the foreground. It doesn't always happen, but I think I've managed to isolate what is causing it. I am using this line:

self.locationManager.delegate = self;

Where self.locationManager is a retained property. When I comment this line out, the app can repeatedly come into the foreground and not crash.

I dont really understand what happens to viewcontrollers when they go into the background or come into the foreground.

Any ideas?


I managed to fix it now.

I added this line to the dealloc method of the viewcontroller:

self.locationManager.delegate = nil;

That seemed to sort it out....

0

精彩评论

暂无评论...
验证码 换一张
取 消