vendredi 4 avril 2014

Why not enforce singleton application delegate object?


Vote count:

0




I just ran myself round in circles, all coming down to having instantiated an app delegate object in a secondary NIB that wasn't the NSMainNibFile. Amazing how having two app delegates kicking around means you have separate managedObjectContexts.


Here's a thought-- could I make my application delegate class a singleton? And safely instantiate it in XIBs? What would that break?


Also, there are some mentions on stackoverflow that [[UIApplication sharedApplication] delegate] is a "singleton" but it doesn't appear that UIApplicationDelegate protocol guarantees that, nor is the superclass UIResponder a singleton, either. So could I shoot myself in the foot in this regard on iOS as well?



asked 26 secs ago






Aucun commentaire:

Enregistrer un commentaire