Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"wait_fences: failed to receive reply: 10004003"?

I get this cryptic error the first time (and only the first time) my view is loaded due to the following line of code:

- (void)viewWillAppear:(BOOL)animated {     [textField becomeFirstResponder]; } 

There is a noticeable (~3 – 4 second, even on the simulator) delay due to this that makes my app feel unresponsive. Does anyone know how to fix this? I can't find any documentation on it on Apple's site, or any solutions here or on Google.

Strangely, the opposite situation happens if I put the line in -viewDidAppear: instead of -viewWillAppear:; that is, instead of printing the error only the first time the keyboard is shown and never again, the error is not printed the first time but every time after. This is causing a major headache for me.

like image 371
Michael Avatar asked Sep 03 '09 03:09

Michael


2 Answers

Override -viewDidAppear:, not -viewWillAppear, and make sure to call [super viewDidAppear:]. You should not perform animations when you are not on screen ("will appear"). And the -viewDidAppear: docs explain that you must call super because they have their own things to do.

like image 183
Rob Napier Avatar answered Sep 19 '22 11:09

Rob Napier


I was getting a similar error when quickly:

  1. Dismissing a modal view
  2. Updating the main view
  3. Presenting a new modal view

I noticed I was only getting it in the simulator and not on the device. Additionally, I was getting caught in an infinite loop.

My solution was to delay the presenting of the new modal view. It seems that quickly updating the view hierarchy caused some sot of race condition in Apple's code.

With that in mind, try this:

     - (void)viewDidAppear:(BOOL)animated{              [super viewDidAppear:animated];             [textField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.1];   } 

You may be having issues presenting the keyboard for a UITextField that ins't yet on screen. This may be causing problems similar to mine.

Also, you pause giving the hierarchy time to update before presenting the keyboard, just in case.

Hope this helps.

like image 21
Corey Floyd Avatar answered Sep 20 '22 11:09

Corey Floyd