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

  • Home
  • SEARCH
  • 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 7440613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:52:44+00:00 2026-05-29T10:52:44+00:00

Let’s say I want to create new objects than exist throughout the duration of

  • 0

Let’s say I want to create new objects than exist throughout the duration of the program. I need them to be created at startup and continuously run background tasks throughout the program. If I put them in the application’s delegate under applicationDidFinishLaunching, do the objects exist throughout the duration of the program or just the scope of applicationDidFinishLaunching? After applicationDidFinishLaunching returns, do my objects go out of scope or do they keep running background tasks? If so, how do I ensure the objects exist throughout the duration of the program and continue to run background tasks?

The “background tasks” are being run on separate threads. I am using Objective-C with Xcode 3.2.6 on Mac OS X Snowleopard.

  • 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-29T10:52:44+00:00Added an answer on May 29, 2026 at 10:52 am

    The lifetime of Objective-C objects is controlled manually (assuming you’re not using garbage collection or ARC). You shouldn’t ask if they exist throughout the duration of the program—instead, you should make sure that each reference to an object, no matter where it is (main thread, background thread) is properly retained. See the basic memory management rules.

    Specifically, if you create an object with [[MyClass alloc] init], you now have an owning reference to that object (that you are responsible for eventually releasing). If you then start a new thread and give that thread a reference to your object, that thread should call [obj retain] to ensure that the object will continue to exist, and [obj release] when it’s done with the object.

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

Sidebar

Related Questions

Let's say I dynamically create a timer like this: System.Timers.Timer expirationTimer = new Timer(expiration
Let's say you create a wizard in an HTML form. One button goes back,
Let's say I have a drive such as C:\ , and I want to
Let's say I need a 3-digit number, so it would be something like: >>>
Let's say there is a graph and some set of functions like: create-node ::
Let's say I'm creating an OpenGL game in C++ that will have many objects
Let's say I have an image called hello.png with dimensions 200x100 . I create
Let's say I need to scroll a very long list of tweets on twitter.
Let's say the Activity I want to start is named OccupyThePieShop I was previously
Let's say, if I need to assign an id to element with first name,

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.