I guess your big question is whether this behavior is common and expected. The answer is the following - it depends. It is an implementation decision. I've seen frameworks working both ways. Usually, you can guess the behavior from the method naming.
For example, a new instance of CLLocationManager
has to be created before use. Once you have to call alloc
and init
, you should always keep the reference.
On the other hand, in frameworks where you don't create a new object, you don't need to hold the reference - for example [NSNotificationCenter defaultCenter]
or [UIApplication sharedApplication]
. The framework holds the reference for you.
Frameworks which use class methods (e.g. STTwitter
) also typically hold the references for you.
Your following assumption
and the delegate methods receive a reference to the CLLocationManager
is wrong. The delegate is only a set of methods. It doesn't hold anything if you don't implement it explicitly. Note that you have to also keep a reference to the delegate. The manager won't keep it alive.