I'm using AFNetworking
to make a web request. After the web request completes. I want a UIAlertView to be shown. I'm using ARC and the code seems to work on devices. If I use a simulator I get an error: EXC_BAD_ACCESS
What am I doing wrong?
UIAlertView* postSubmitAlertView = [[UIAlertView alloc] init];
postSubmitAlertView.delegate = self;
[postSubmitAlertView addButtonWithTitle:@"Ok"];
AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc]
initWithRequest:request];
[op setCompletionBlock:^(void) {
if(op.response.statusCode == 200) {
postSubmitAlertView.title = @"Submission Good";
postSubmitAlertView.message = @"GOOD";
} else {
postSubmitAlertView.title = @"Submission Failed.";
postSubmitAlertView.message = @"FAIL";
}
[postSubmitAlertView show];
}];
[op start];