Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3304176
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:02:04+00:00 2026-05-17T21:02:04+00:00

If I have a tab bar app, and plan on using Core Location in

  • 0

If I have a tab bar app, and plan on using Core Location in different tabs, is there a good common place to put the code used to alloc/init the CLLocationManager, and get the updates once startUpdatingLocation is called? Or if it’s going to be used in two different tabs, do I then just put it in the code for each tab? Just wondering what best practices are since I am new to programming. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:02:04+00:00Added an answer on May 17, 2026 at 9:02 pm

    if you notice you’re duplicating what you’ve written, or faced with writing code which exists, consider creating an interface (object, set functions, etc.) to handle these tasks.

    see DRY (do not repeat yourself). there will be a lot of duplicate functionality by the time you’ve written a few apps. it’s best to write it once, and to write that correctly.

    here are some high level guidelines:

    • don’t put app-specific features in a common interface (instead, use a subclass shared by the 2 projects)

    • always keep your bases free of hacks (unless you’re dealing with an issue in the system libraries). if clients (e.g., subclasses, callers) need a particular workaround or require a specific check, then it is better to make them handle it.

    • use assertions to ensure they use the interface as intended, check every argument, precondition/postcondition, the state of your object, etc..

    • keep your objects/interfaces very small and maintainable, with a clear purpose of their intended use. naturally, this will result in a higher number of objects.

    • avoid the urge to use singletons and static data; there’s almost always a better way even if it’s as simple as forcing clients to create an instance of your class.

    • create libraries with these interfaces, and divide them logically.

    now that that’s covered…

    i’d begin by using (potentially multiple) instances of the objects you’ll need. there is nothing in the documentation that states “you should not create multiple instances of the object”.

    if this is somehow inadequate in profiling, then consider using a shared object which relays messages to the objects (in your app) which need updates.

    rationale: chances are, apple’s already optimized the implementation, so you don’t have to.

    finally, i broke these guidelines in an app which required a ton of location requests, and displayed a ton of location information. the app used some static data behind an interface which stored the location manager and the location (among other things). so i ended up using static data with private (hidden) static data to reduce the memory and cpu demands in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Tab Control with multiple Tab Pages. I want to be able
I have a tab navigator control and I would like to make all of
I have a tab page that should be hidden if a property (BlahType) is
I have 2 tab items. In tab No.1 I have a control which corresponds
I have a tab delimited file where each record has a timestamp field in
Modern browsers have multi-tab interface, but JavaScript function window.showModalDialog() creates a modal dialog that
So I have a form with lots of controls that all have a tab
I have a huge tab separated file which I want to sort on its
I have to parse a tab-delimited text file with Ruby to extract some data
I have a new web app that is packaged as a WAR as part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.