wait_fences: failed to receive reply: 10004003 error - UIAlertView with UIActivityIndicatorView

北战南征 提交于 2020-01-13 19:50:09

问题


I hoped that the answers to squeezemylime's question would solve my problem as I also have a UIAlertView without text field but it did not work out well. Instead of a text field I placed a UIActivityIndicatorView animating on it and no buttons used on creation. So the alert gets programmatically dismissed so that the delegate method destroys the spinner on the alert and the alert itself (which has been retained through the time running).

So, I'm getting also these wait_fences: messages within the debugger and I'm frozen in the meantime because everything I tried including the valuable hints in this thread won't kill these wait_fences: messages. There is no crash, neither with GDB nor on the device.

Stepping through the code I realized that wait_fences: message is shown directly after the delegate for dismissWithClickedButtonIndex:0 animated:NO releases the questionable UIAlertView. Then I thought it could be similar to squeezemylime's delay technique and did this:

[theAlertObj performSelector:@selector(dismissWithClickedButtonIndex:animated:) withObject:nil afterDelay:0.1];

and the wait_fences: message was gone! But the call to dismissWithClickedButtonIndex:animated: can't be satisfied because it is missing the second argument animated:NO - so I tried it with some changes implementing a method for the call:

- (void)dismissNamedAlert: (UIAlertView*)alert
{
    [alert dismissWithClickedButtonIndex:0 animated:NO];
}

- (void)postProcessLogicalWork: (id)arg
{
    [self performSelector:@selector(dismissNamedAlert:) withObject:theAlertObj afterDelay:0.2];
    ...
}

Bummer: the wait_fences: message re-appeared! I think I can't go back to the working solution having an unsatisfied method call - so how can it be done? And/or under which circumstances do these wait_fences: messages occur?

Briefly the workflow for my thing is like this:

  • viewDidAppear calls its super and then my data updater afterDelay:0.3f
  • the data updater invokes a new thread for the update procedure
  • the new thread creates and displays the alert with spinner on the main thread and then runs for some seconds
  • the new thread performs a finishing procedure on the main thread and is done
  • the finisher dismisses the alert as described above (with wait_fences:) and refreshes the display if needed
  • the rest is idle time ... for the moment being

Any ideas what to do?


回答1:


I don't know the reason why thing happens but sort out this problem by changing this line

[alert dismissWithClickedButtonIndex:0 animated:NO];

to this one

[alert dismissWithClickedButtonIndex:0 animated:YES];


来源:https://stackoverflow.com/questions/5162484/wait-fences-failed-to-receive-reply-10004003-error-uialertview-with-uiactivi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!