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 7961387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:01:07+00:00 2026-06-04T05:01:07+00:00

I have a storyboard application. When the first view is loaded on startup, I

  • 0

I have a storyboard application. When the first view is loaded on startup, I have this code to instantiate my main background thread and it all works fine.

    public override void AwakeFromNib()
    {
        base.AwakeFromNib();
        // Perform one-time initialization in this function

        // Create and start the main worker thread
        MainBackgroundThread = new Thread(new ThreadStart(MainLoop.RunWorker));
        MainBackgroundThread.Start();
    }

However, when the user goes to a different view and then goes back to the first view via a segue, AwakeFromNib() is called again. I thought it was only supposed to be called once… Where do I start my main background thread so it only ever gets started once?

  • 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-06-04T05:01:08+00:00Added an answer on June 4, 2026 at 5:01 am

    AwakeFromNib will be called every time that a new instance of that view is loaded from the storyboard/segue. If you are segueing in your storyboard, you should expect AwakeFromNib to be called every time because you are truly creating a new instance of the view, from a nib object. If you want to start a background thread, you could try something like:

    public override void AwakeFromNib()
    {
        static NSThread * thread;
    
        base.AwakeFromNib();
        // Perform one-time initialization in this function
    
        // Create and start the main worker thread
        if(!thread)
        { 
             thread = new Thread(new ThreadStart(MainLoop.RunWorker));
        }
    
        MainBackgroundThread = thread;
        MainBackgroundThread.Start();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a storyboard setup as a Tabbed Application with first view controller containing
I have a storyboard set up with working login and main view controller, the
I have a TabController-based storyboard application with 4 different navigationController, one each tab. The
Possible Duplicate: Xcode: Storyboard Tabbed Application Passing Data Back and Forth Basically I have
I have a view on a storyboard the has a button to perform a
I have this iPad app using Storyboard. There are some file that are marked
I am using a storyboard and I have added iAd banner to my view.
On the first run of my application I show an alert view to the
I don't seem to get this SIGABRT I keep getting. I have this storyboard
Given a storyboard-based application, how can any one view controller invoke the methods of

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.