Reputation: 1556
Where should I put the the location methods in a Tabbar app?
In the appdelegate or in a tab?
[edit]
details of scenario:
I need to track user position every 500 meters he move, even when the app is in the background
Upvotes: 0
Views: 278
Reputation: 70703
If you need this data in more than one place (object, view controller, etc.) then put it in a (MVC paradigm) shared Model object that records the location information.
For the simplest a-couple-pages-long apps, many people use the App Delegate as The Model Object. This may work OK for small projects, but does not scale well for projects that become significantly larger.
Upvotes: 0
Reputation: 5940
That all depends. If you want it every time your app is opened you should put it in your app delegate -applicationDidFinishLoading:
If you only want it if the user does a certain action or when the user loads a certain view then you should put it within that function or viewDidLoad
of that viewController.
Upvotes: 2
Reputation: 8707
Put it there, where it is most useful for you. E.g., if it is need by some specific View Controller, put Core Location stuff there. If it is need globally, you may create a singleton for it, and put code there.
I personally think, AppDelegate is bad to place Core Location code directly there.
Upvotes: 2