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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:13:41+00:00 2026-05-12T05:13:41+00:00

I would like to present multiple modal views in sequence (e.g. show confirmation page

  • 0

I would like to present multiple modal views in sequence (e.g. show confirmation page after selecting a picture from image picker). My problem is that the animation of dismissal and presenting in subsequent steps without delay always crashes the app with an EXC_BAD_ACCESS.

I assume that the problem is that CoreAnimation does not distinguish between the two transitions and cannot detect properly whether the first one has ended or not.

My work around so far is to introduce a 1 section delay which seems to solve the problem. However, I think that this makes the code a bit fragile. Is there another workaround?

Is this a bug in UIKit and should I submit a bug report?

Sample code

Here is a simple case that reproduce the crash:

  1. Create a new View-based project with the following class as the implementation of the main controller

  2. Hit ‘cancel’ when image picker view is presented

Expected behavior: the picker view is dismissed and presented again due to the subsequent call in viewDidAppear.

Actual behavior: It crashes with the stack trace presented below.

Code:


#import "SampleViewController.h"

@implementation SampleViewController

- (void)showModal {
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    [self presentModalViewController:picker animated:YES];
    // [picker release];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self showModal]; // this line crashes the app
    // the following works as desired
    // [self performSelector:@selector(showModal) withObject:nil afterDelay:1];
}

@end

Crash Stack trace:

#0  0x30b43212 in -[UIWindowController transitionViewDidComplete:fromView:toView:]
#1  0x3095828e in -[UITransitionView notifyDidCompleteTransition:]
#2  0x3091af0d in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
#3  0x3091ad7c in -[UIViewAnimationState animationDidStop:finished:]
#4  0x00b54331 in run_animation_callbacks
#5  0x00b54109 in CA::timer_callback
#6  0x302454a0 in CFRunLoopRunSpecific
#7  0x30244628 in CFRunLoopRunInMode
#8  0x32044c31 in GSEventRunModal
#9  0x32044cf6 in GSEventRun
#10 0x309021ee in UIApplicationMain
#11 0x00002794 in main at main.m:14
  • 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-12T05:13:41+00:00Added an answer on May 12, 2026 at 5:13 am

    Chances are you need to let the animation context finish. As you already discovered

    [self performSelector:@selector(showModal) withObject:nil afterDelay:1];

    works, but obviously, having a delay is no good, so do this:

    [self performSelector:@selector(showModal) withObject:nil afterDelay:0.0];
    

    When you use afterDelay:0.0 it doesn’t directly call the selector, instead it enqueues the invocation on your runloop, which lets all of your state (autorelease pools, animation contexts, etc) uwnind correctly then immediately calls your invocation when the runloop starts processing events.

    The one issue that might croup is that users could get UIEvents going off by tapping the screen, but you can fix that with by calling this before you are animation starts

    [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
    

    and this once you have your final modal on the screen

    [[UIApplication sharedApplication] endIgnoringInteractionEvents];
    

    Generally you want to spend UI interactions while you are animating quick transitions anyway.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I ended up doing a crude string substitution replace \n… May 12, 2026 at 9:27 pm
  • Editorial Team
    Editorial Team added an answer Selenium might be a good way to go; it handles… May 12, 2026 at 9:27 pm
  • Editorial Team
    Editorial Team added an answer There are a number of reasons not to use malloc… May 12, 2026 at 9:27 pm

Related Questions

Am trying to simplify the create / edit view for a multi-model controller. User
I am developing an application based on questions and answers, and I would like
I’m on the learning curve up the Silverlight trail. I’m a data-centric developer so
I have multiple text files with logged data like this: 6/23/09 17:00 0.443 6/23/09

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.