I have an app with a tab bar and 3 tabs. The current location of the user is going to be needed to be known on any of the three tabs. Would the best place to implement CLLocationManager
be in the app delegate in this case?
Is it ok (good practise?) to put the CLLocationManager delegate methods in the app delegate m file?
Where would you suggest i place the CLLocationManager
as I'm going to be calling -startUpdatingLocation
from any of the three tabs?
Thanks
Best Answer
The app delegate is a reasonable place to put it. Another option would be to create a custom singleton factory class that has a class method that returns your location manager delegate and implement the delegate methods there. That would keep your app delegate class cleaner.
Here's a skeleton singleton class implemention based off of Peter Hosey's "Singletons in Cocoa: Doing them wrong". This may be overkill, but it's a start. Add your delegate methods at the end.