I have created request and I want to popView when i will get success message in response. Here is my code :
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];
Below isn't working,
[self.navigationController popViewControllerAnimated:YES];
Does anyone have an idea why this is happening? UINavigation controller
is also same for both the viewControllers
. Please help me,Thanks.