wait_fences:未能收到回复:10004003错误 - UIAlert没有UITextField存在 [英] wait_fences: failed to receive reply: 10004003 error - UIAlert WITHOUT UITextField present
问题描述
我正在开发一个应用程序,当用户第一次开始使用它来询问他们是否想要使用他们当前的位置时,会弹出UIAlert。这发生在主控制器内。但是,使用UIAlert时出现以下错误:
I am working on an app where a UIAlert pops up the first time the user begins using it to ask if they want to use their current location. This happens within the main controller. However, I get the following error when using the UIAlert:
wait_fences: failed to receive reply: 10004003
我调试了它,然后用Google搜索。我没有使用textarea或键盘输入,所以我不必辞职第一响应者。但是,我仍然无法弄清楚为什么我会收到此错误。它只在我添加UIAlert时出现。
I debugged it, and googled around. I am not using a textarea or keyboard input, so I don't have to resign a first responder. However, I still cannot figure out why I would be getting this error. It only appears when I add the UIAlert.
MainController.m
- (void)viewDidLoad {
UIAlertView *mainAlert = [[UIAlertView alloc]
initWithTitle:@"Location"
message:@"Do you wish to use your current location?"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"No Thanks", @"Sure!", nil];
[mainAlert show];
[mainAlert release];
[super viewDidLoad];
}
头文件的构造如下:
@interface MainController : UIViewController
<CLLocationManagerDelegate,
MKReverseGeocoderDelegate, UIAlertViewDelegate>
推荐答案
我通过添加稍微延迟来解决这个问题UIAlert:以下是我的 ViewDidLoad 方法(它在 ViewDidAppear 中也能正常工作):
I solved this problem by adding a slight delay to the UIAlert: The below is within my ViewDidLoad method (it also works fine within ViewDidAppear):
[self performSelector:@selector(testAlert) withObject:nil afterDelay:0.1];
由于某种原因,延迟成功了。然后我调用了另一种方法(我当然会将其重命名为..):
for some reason that delay did the trick. I then called another method (I will rename it of course..):
- (void) testAlert
{
UIAlertView *mainAlert = [[UIAlertView alloc] initWithTitle:@"Location" message:@"Do you wish to use your current location?" delegate:self cancelButtonTitle:nil otherButtonTitles:@"No Thanks", @"Sure!", nil];
[mainAlert show];
[mainAlert release];
}
这篇关于wait_fences:未能收到回复:10004003错误 - UIAlert没有UITextField存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!