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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:40:49+00:00 2026-05-11T07:40:49+00:00

Resolution: While trying to recreate this bug in a fresh project to submit to

  • 0

Resolution: While trying to recreate this bug in a fresh project to submit to Apple, I discovered that it is specific to iPhone OS 2.1, and compiling for 2.2 fixes the problem. Stephen, thanks for your help; I’ll be accepting your answer since it would have worked if the bug still existed or I wasn’t willing to compile for 2.2.


I have an app which is radically changing its database schema in a way that requires me to transform old-style records to new-style ones in code. Since users may store a lot of data in this app, I’m trying to display a modal view controller with a progress bar while it ports the data over (i.e. as the very first thing the user sees). This view controller’s viewDidAppear: begins a database transaction and then starts a background thread to do the actual porting, which occasionally uses performSelectorInMainThread:withObject:waitUntilDone: to tell the foreground thread to update the progress bar.

The problem is, viewDidAppear: is being called twice. I noticed this because that ‘start a transaction’ step fails with a ‘database busy’ message, but setting a breakpoint reveals that it is indeed called two times—once by -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:], and again by -[UIViewController modalPresentTransitionDidComplete]. Those names appear to be private UIViewController methods, so I’m guessing this is either a framework bug, or I’m doing something UIKit isn’t expecting me to do.

Two relevant code excerpts (some irrelevant code has been summarized):

- (void)applicationDidFinishLaunching:(UIApplication *)application {     (register some default settings in NSUserDefaults)      // doing this early because trying to present a modal view controller      // before the view controller is visible seems to break it     [window addSubview:[self.navigationController view]];      // this is the method that may present the modal view     [self.databaseController loadDatabaseWithViewController:self.navigationController];      if(!self.databaseController.willUpgrade) {         [self restoreNavigationControllerState];     } } 

And from my DatabaseController class:

- (void)loadDatabaseWithViewController:(UIViewController*)viewController {     (open the new database)      (compute the path the old database would live at if it existed)      if([[NSFileManager defaultManager] fileExistsAtPath:oldDBPath]) {         (open the old database)          [viewController presentModalViewController:self animated:NO];     } } 

So, is there something I’m screwing up here, or should I file a bug report with Apple?

  • 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. 2026-05-11T07:40:49+00:00Added an answer on May 11, 2026 at 7:40 am

    I saw this in my app too. I never got it entirely confirmed, but I think this is what’s happening:

    1. Load root view
    2. Load modal view
    3. OS sends view did appear notification for the view in step 1
    4. The current view controller, which in this instance happens to be your DatabaseController class, picks it up
    5. OS sends the view did appear notification for the modal view
    6. The current view controller gets the notification. In this case it’s the exact same controller as last time

    In my case I just reset what happened in the first call to viewDidAppear:.

    In your case two options spring to mind: a static variable to track whether you’ve started the upgrade already; or look at the UIView* parameter passed in before starting.

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

Sidebar

Ask A Question

Stats

  • Questions 104k
  • Answers 104k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'd start by narrowing down the problem. For instance, what… May 11, 2026 at 8:34 pm
  • Editorial Team
    Editorial Team added an answer Yes, the latest Rails works fully with Ruby 1.9.1. Issues… May 11, 2026 at 8:34 pm
  • Editorial Team
    Editorial Team added an answer As the API docs you linked to yourself already point… May 11, 2026 at 8:34 pm

Related Questions

here's what I'm trying to do: I have a Storyboard animation for an object
I have a VS 2008 project under TortoiseSVN source control. I am the only
I'm trying to read a 16-bit greyscale TIFF file (BitsPerSample=16) using a small C
Accuracy Vs. Precision What I would like to know is whether I should use

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.