“wait_fences: failed to receive reply: 10004003”?

2019-01-01 14:26发布

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.

18条回答
后来的你喜欢了谁
2楼-- · 2019-01-01 15:03

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.

查看更多
浅入江南
3楼-- · 2019-01-01 15:03

Alertview or actionsheets should be shown on main threads...so if your making any synchronous connections and performing that operation on another thread and showin alerts on the basis of output you received from that operation then you will get this error message wait_fences: failed to receive reply: 10004003 . You can do something like....

[self performSelectotOnMainThread:@selector(handleOutput:) withObject:output waitUntilDone:YES/NO];

and show alerts in handleOutput method passing the output response string as the parameter.

查看更多
君临天下
5楼-- · 2019-01-01 15:06

After few tests the big rule is: "Do not perform animation before animated dismissal or animated show.".

For example:

  • do not call -dismissModalViewControllerAnimated:YES after the delegation callback of an UIAlertView -alertView:willDismissWithButtonIndex: (wait the fade out of the alert view before doing this using the -alertView:didDismissWithButtonIndex: callback)
  • do not try to show the keyboard (becomeFirstResponder) before your view controller is on screen.

Bad things may happen.

Hope it will be useful ;-)

查看更多
柔情千种
6楼-- · 2019-01-01 15:06

You have done [textfield becomeFirstResponder];

And after you get the value from textfield in your code, do [textfield resignFirstResponder];. That will help you, I think.

查看更多
像晚风撩人
7楼-- · 2019-01-01 15:09

override viewDidappear, not viewWillAppear:

-(void) viewDidAppear:(BOOL) animated
{
 [super viewDidAppear:animated];
 [myTextField becomeFirstResponder];
}
查看更多
登录 后发表回答