라벨이 hierarchy인 게시물 표시

whose view is not in the window hierarchy

swift 5로 코드를 작성 중이었다. self.performSegue(withIdentifier: "ResultToMainSegue", sender: nil) 이 코드가 실행 되면서 나는 오류이다. 그냥 버튼에 이벤트로 적용하면 잘 되는데... 구글 애드몹을 적용하여 광고를 시청하고 끝나는 시점에 넣으니 오류가 난다. whose view is not in the window hierarchy 검색해보니 대충 이게 첫번째 뷰가 아니어서 그런다 첫번째 뷰를 찾아서 거기서 명령을 실행해야 한다고 한다. 그렇게 해보았다. 역시 되지 않는다. 내가 해결한 방법은 이것이다. DispatchQueue.main.async {   self.performSefue(withIdentifier: "ResultToMainSegue", sender: nil) } 이렇게 하니 잘된다. 현재 뷰에서 광고뷰로 넘어가고 다시 현재 뷰로 넘어오면서 뷰의 계층 구조가 명확히 정립되지 않은 상태에서 메인창을 호출하니 오류가 날때도 있고 아닐때도 있었을꺼 같다. 항상 기초에 충실해야겠다.

whose view is not in the window hierarchy 오류 대처 방법

whose view is not in the window hierarchy 오류가 난다. EkEventEditViewController 가 ViewController 위에 생성이 되었다고 하면서 나는 오류이다. 혹시나 해서 ViewController 를 NavigationViewController 로 변경해도 마찬가지이다. UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;     while (topController.presentedViewController) {         topController = topController.presentedViewController;     } [topController presentViewController:addEventVC animated:YES completion:nil]; 위의 구문을 넣어주면 된다.