I used to fight for a while with strange issue. I am using Singleton in my iOS application to hold Session information. Unfortunately when using NSMutableArrayList to hold stack of current objects - the references become empty at some point and there is a warning like:

warning: Attempting to create USE_BLOCK_IN_FRAME variable with block that isn't in the frame.

While searching on the net - I have mentioned one comment about using singletons - well - this was my lead.

I am using common singleton macro that defines most of the memory management methods. Exactly in session manager I used the macro, before @synthesize - this was the problem, static definitions should not appear before synthesized methods. So if you have something like:

``I used to fight for a while with strange issue. I am using Singleton in my iOS application to hold Session information. Unfortunately when using NSMutableArrayList to hold stack of current objects - the references become empty at some point and there is a warning like:

warning: Attempting to create USE_BLOCK_IN_FRAME variable with block that isn't in the frame.

While searching on the net - I have mentioned one comment about using singletons - well - this was my lead.

I am using common singleton macro that defines most of the memory management methods. Exactly in session manager I used the macro, before @synthesize - this was the problem, static definitions should not appear before synthesized methods. So if you have something like this, just replace it with:

@synthesize loggedUserId, ...
SYNTHESIZE_SINGLETON_FOR_CLASS(SessionManager)