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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:31:30+00:00 2026-05-29T22:31:30+00:00

I just spent a day tracking down a really weird bug. It was a

  • 0

I just spent a day tracking down a really weird bug. It was a UILabel being overreleased, although in the code there was no over-releasing. If I commented out the release of the label, code was fine.

I tracked it down to a UIView that was being released in a background thread. Which didn’t seem right as you’re supposed to access all UI elements from the main thread. I then found a nib file that was being loaded in a background thread using:

[[NSBundle mainBundle] loadNibNamed:@"nib name" owner:self options:nil];

I don’t need to go into the details of what the code was doing, but my question is:

If loadNibNamed is called in a background thread and the view loaded is cached by the nib loading process, then the main thread wants to load that nib too – but loads it from a cache. When my object is released – is the view loaded from the nib in the background also released in the background..?? Doesn’t really make sense as the background thread would no longer exist anyway….

I don’t know, but I resolved it by wrapping the loadNibNamed part of the code in a GCD dispatch onto main thread synchronously.

  • 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-29T22:31:31+00:00Added an answer on May 29, 2026 at 10:31 pm

    All UI-related operations should be done from the main thread.

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

Sidebar

Related Questions

I just spent most of a day tracking down a very strange case where
Ok, I have just spent the whole day playing with DomDocument and creating some
I have just spent all day attempting to get NHibernate.Search working alongside NHibernate 2.0
I've spent a day on this so far and just can't figure it out.
I have just spent half a day quietly going mad. I'm making changes to
I spent a whole day looking for a bug caused by wrongly passing Windows
I just spent too much time of my day trying to figure out some
I just spent half an one our to find out what caused the Error-Message
I just spent way too long trying to diagnose why, in the following snippet
I just spent 5 hours by checking Google gadgets websites and FAQs, but I

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.