2016-11-09 13 views
1
parameters:params 
    progress:nil success:^(NSURLSessionTask *task, id responseObject) 
{ 
    NSLog(@"%@",[responseObject valueForKey:@"status"]); 
    NSString *status=[responseObject valueForKey:@"status"]; 

    if([[responseObject valueForKey:@"status"] isEqual: @"success"]) 
    { 

は、ここで私は、ルートのViewController私はサインアップページをしています、ステータス=成功時にサインインページに戻りたいと思います。しかし、ここでは起こっていない?

  [self.navigationController popViewControllerAnimated:YES]; 

にGoBackをしたいが、何も

 } 
} 

failure:^(NSURLSessionTask *operation, NSError *error) { 

    NSLog(@"Error: %@", error); 
+0

に変更してもよろしいですか? ..いくつかのコードを表示します。 – vaibhav

答えて

1

「サインアップ」ビューコントローラーのセグを「サインイン」コントローラーにドラッグすることを除いて、以前と同じようにセグを作成してください。

セグを選択した状態で、属性インスペクタの識別子を 'goToSignIn'と設定します。 コードを

if([[responseObject valueForKey:@"status"] isEqual: @"success"]) 
    { 
    [self performSegueWithIdentifier:@"goToSignIn" sender:self]; 
} 
+0

Thanks Dude、あなたは私の人生を保存しました#Thithirru #Mandan – Ramanan

0

あなたの完了ブロックがメイン(UI)スレッドではなく、ここでは起こりません。これを試してみてください:

__weak __typeof__(self) weakSelf = self; 
    parameters:params 
    progress:nil success:^(NSURLSessionTask *task, id responseObject){ 
    NSLog(@"%@",[responseObject valueForKey:@"status"]); 
    NSString *status=[responseObject valueForKey:@"status"]; 

if([[responseObject valueForKey:@"status"] isEqual: @"success"]){ 
    // here i want to goback to root ViewController 
    dispatch_async(dispatch_get_main_queue(), ^{ 
      [weakSelf.navigationController popViewControllerAnimated:YES]; 
      }); 
    } 
} 
failure:^(NSURLSessionTask *operation, NSError *error) { 
    NSLog(@"Error: %@", error); 
} 
関連する問題