사용자가 내 앱에 로그인하면 POST 요청을 사용하여 내 서버에 사용자 프로필을 전송하고 성공하면 내 컨트롤러에 알리고 성공 블록을 호출하여 segue는 작동하지 않지만 아무 일도 일어나지 않습니다.비동기 블록에서 segue 수행
다음 블록의 내 코드 :
RemoteCallManager *rcm = [[RemoteCallManager alloc] init];
if (![[NSUserDefaults standardUserDefaults] boolForKey:IS_FIRST_LAUNCH])
{
// Is first launch
[rcm sendNewUserProfile:self.player andSuccessBlock:^(NSDictionary *result) {
[[Utils sharedInstance] extractAndSaveSessionDataWithResultFromRequest:result];
[(AppDelegate*)[[UIApplication sharedApplication] delegate] setPlayer:self.player];
[(AppDelegate*)[[UIApplication sharedApplication] delegate] archivePlayerObject];
[(AppDelegate*)[[UIApplication sharedApplication] delegate] archiveGameSession];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:IS_FIRST_LAUNCH];
[self performSegueWithIdentifier:@"pushToMenu" sender:self];
} andErrorBlock:^(NSString *description) {
NSLog(@"An error occured : %@", description);
}];
}
else
{
// Is not first launch
[self performSegueWithIdentifier:@"pushToMenu" sender:self];
}
내가 성공하지 dispatch_sync에 SEGUE 전화를 시도했다.
도움 주셔서 감사합니다.
앱이 'prepareForSegue :'를 통과합니까? mainthread 만 UI를 업데이트 할 수 있기 때문에 배경/전경과 관련된 문제 일 수 있습니까? – Larme
예. 통과합니다. 그것은 내가 mainthread에 대해 생각한 것입니다. 그래서 dispatch_sync를 사용하여 주 스레드에서 segue를 수행하려고했지만 – Nonouf
*을 사용합니다. 그러나 dispatch_sync (dipsatch_get_main_queue(), ...)를 사용하면 segue가 수행되지 않습니다 – Nonouf