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 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

Related Questions

I'm trying to write a resolution selection dialog that pops up when a program
I am facing a class resolution issue while trying to make my architecture flexible.
I'm trying to center a page on any resolution while still being able to
We've been seeing this problem for a while now and I'm really trying to
I wanted to change the resolution of a image,this image I am getting from
I have a graphical app that needs to test the resolution of the display
I have a memory buffer corresponding to my screen resolution (1280x800 at 24-bits-per-pixel) that
I'm trying to do a remote desktop viewer. For this I need to send
I am new in android world. When I create a project while setting Target
I have created my iPhone .png application 'icon' (57x57 with 72 Resolution), however, when

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.