Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
256 views
in Technique[技术] by (71.8m points)

iphone - wait_fences: failed to receive reply: 10004003 error - UIAlert WITHOUT UITextField present

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

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];
}

The header file is constructed like this:

@interface MainController : UIViewController 
<CLLocationManagerDelegate,
 MKReverseGeocoderDelegate, UIAlertViewDelegate>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The reason for this wait_fences: failed to receive reply: can also be that you try to show an alert while not being on the mainThread (which is the GUI thread).

Dispatching to the GUI thread helps:

dispatch_async(dispatch_get_main_queue(), ^{ 
  [mainAlert show];
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...