Weird error: wait_fences: failed to receive reply: 10004003

I know that there are other questions that deal with this error, but those answers don't help me any. I was wondering if anyone knew the exact cause, and if no one does, here is the code:

-(void) imagePickerController : (UIImagePickerController *) picker
        didFinishPickingImage : (UIImage *) image
                  editingInfo : (NSDictionary *) editingInfo {

    self.imageView.image = image;
    [picker dismissModalViewControllerAnimated:YES];
    [picker release];
    //[self myNextResponder];

This error: wait_fences: failed to receive reply: 10004003, appears right after this method exits. I have googled all over, and cannot figure it out.


It appears that you used the picker object as the caller of present/dismissModalViewController. The documentation recommends using the "parent" view controller.

For the "parent" I used self.navigationController (since it won't be going anywhere)

The implementation of my picker delegate's cancel method looks like this...

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
    // make sure the picker doesn't try to access the soon to die delegate
    picker.delegate = nil;

    [self.navigationController dismissModalViewControllerAnimated:YES];
    [self.navigationController popViewControllerAnimated:YES];

Simply comment the line

//[picker release];

and try

Make sure you don't have any keyboards shown up on the screen. Use [yourTextFieldOrTextView resignFirstResponder] if you have. Thanks

Is a keyboard visible when you present the modal UIImagePickerController? I encountered this same problem and was finally able to solve it by resigning first responder status on my text view before presenting the image picker.

- (void)showImagePicker {
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self.textView resignFirstResponder]; // IMPORTANT: dismiss keyboard
    [self presentModalViewController:picker animated:YES];
    [picker release];

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    [self dismissModalViewControllerAnimated:YES];

I also bring the keyboard back up in viewDidAppear: -- NOT viewWillAppear:.

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.textView becomeFirstResponder];

Hope this helps!

Need Your Help

Translating @interface UIView from Objective-C to Swift

ios objective-c swift uiview uikit-dynamics

I'm following an Objective-C tutorial on how to animate a menu with UIKit Dynamics and I'm having some trouble translating the following code from Objective-C to Swift.