Re: iOS: Preventing a singleton from being deallocated when the app is in the background.
Re: iOS: Preventing a singleton from being deallocated when the app is in the background.
- Subject: Re: iOS: Preventing a singleton from being deallocated when the app is in the background.
- From: Alex Zavatone <email@hidden>
- Date: Wed, 19 Oct 2016 22:41:01 -0500
On Oct 19, 2016, at 3:03 PM, Jens Alfke wrote:
>
>> On Oct 19, 2016, at 12:54 PM, Alex Zavatone <email@hidden> wrote:
>>
>> Is there anything wrong with what I'm doing?
>
> Looks fine to me. Is any of this code using manual ref-counting? If so, I’d suspect an over-release.
Thank god, no.
>
>> should I be using [GeofenceControllerSingleton alloc] init] instead of [[self alloc] init]?
>
> It would be slightly safer since it guarantees the base class will be instantiated (which is what you probably expect) instead of any subclass that this factory method is called on.
>
In that case we would find out really quickly, because this is one of the classes that starts up as soon as the app makes several server calls. When our error happens that appears like a dealloc, the app has been running and using this class for a while and is sitting around on iOS while it is in the background.
Yet we are seeing log output indicating the init method getting executed twice.
Thanks much guys.
> —Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden