core location - Where to implement CLLocationManager -


I have a tab bar and 3 tab app, the user's current location is known to any of the three tabs must have. In this case will the app be the best place to implement CLLocationManager in the app?

Is it OK (good practice?) CLLocationManager delegation methods to put in App rep M file?

Where do you say that I am calling CLLocationManager as a place from any of the three tabs I am using -startUpdatingLocation ?

Thank you

App representative is an appropriate place to put it. Another option is to create a custom singleton factory class that contains a class method that returns to your location manager representative and applies the methods of the representative there. This will maintain your app representative class cleaner.

Here is a skeleton singleton class implementation based on Peter Hussie. It can be overkill, but it's a beginning. Finally add your representative methods.

Fixed MyCLLocationManagerDelegate * sharedInstance = Zero; + (Zero) start {if (Shared Instance == zero) Shared Instance = [[Autonomous] init]; } + (ID) sharedMyCLLocationManagerDelegate {// is already defined + start return share instance; } + (Id) allocWithZone: (NSZone *) area {// usually pre-defined + start @ synchronize (self) {if (shared instance) {// caller is expected to get a new object, then the last To save the release message in a manner, put it on // Returns [Maintain shared instances]; } Else {// when not already set, + starting is our collar // it's making a common example, let it go. Return [super olive with zone: zone]; }}} - (id) init {// if shared infinity is zero, + starting is our collar, so start the example // If it is not zero, return the example without initializing it again. If (Shared Instance == Blue) {if ((self = [init init])) // // Start this example I}} Auto Back; } - (id) copywidth zone: (NSZEN *) area {returns self; } - retaining (id) {back self; } - The number to retain (unsigned) [return UINT_MAX; // specifies an object that can not be issued} - (zero) release {// nothing} - (id) autoresz {return self; } #pragma mark - #pragma mark CLLLocationManagerDelegateMethods Go to ...

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -