我已经创建了请求,我想在收到成功消息时弹出视图作为响应。这是我的代码:
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
对于两个viewControllers
也是相同的。请帮助我,谢谢。
@DevTest你不能
把 [self.navigationController popViewControllerAnimated:YES]; 在 dispath 队列中,队列不会弹出 viewController 所以,你将设置侧调度队列...