我已经创建了请求,当我收到成功消息时我想要popView。这是我的代码:
NSURLSession *session = [NSURLSession sharedSession];
NSString *baseURLRequest = [NSString stringWithFormat:@"%@/email_addr=%@",mySession.baseURL,self.txtEmail.text];
NSURLSessionDataTask *dataTask = [session dataTaskWithURL:[NSURL URLWithString:baseURLRequest] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSDictionary *dict = [json objectForKey:@"result"];
NSString *msg = [dict objectForKey:@"msg"];
if ([[dict objectForKey:@"status"] isEqualToString:@"success"])
{
dispatch_async(dispatch_get_main_queue(), ^{
[self showMesssgeonAlert:@"Success"];
[self hideProgress];
[self.navigationController popViewControllerAnimated:YES];
});
}
else
{
}
}];
[dataTask resume];
以下不起作用,
[self.navigationController popViewControllerAnimated:YES];
有谁知道为什么会这样? UINavigation controller
的{{1}}也相同。请帮帮我,谢谢。
答案 0 :(得分:-2)
@DevTest你不能把[self.navigationController popViewControllerAnimated:YES];在dispath队列内部,队列不会弹出viewcontroller所以,你会设置side dispatch queue ...