我AFNetworking
用来发出网络请求。Web 请求完成后。我希望显示 UIAlertView。我正在使用 ARC,代码似乎可以在设备上运行。如果我使用模拟器,我会收到错误:EXC_BAD_ACCESS
我究竟做错了什么?
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];