2016-07-18 4 views
0

내 tvOS 응용 프로그램에서 경고를 표시하고 비디오가 발견되지 않으면 이전보기로 푸는 쇼 segue를 통해 제시된 AVPlayerViewController가 있습니다. 나는 경고 컨트롤러를 만들고, 제시하고, 경고 액션 핸들러에서 긴장을 푸십시오. 모든 것이 예상대로 작동하는 것으로 보이지만 unwound view 컨트롤러가 할당 해제되지 않는 것으로 나타났습니다.AVPlayerViewController 해제 해제 후

let noVideosAlertController = UIAlertController(title: "No Videos Configured", message: "No videos are configured for this bank. Log into the OEC and select Lobby Display to add videos to your playlist.", preferredStyle: .Alert) 
let alertAction = UIAlertAction(title: "OK", style: .Default) { [weak self] (alert) in 
    self?.performSegueWithIdentifier("unwindToConfig", sender: self!) 
} 

noVideosAlertController.addAction(alertAction) 
presentViewController(noVideosAlertController, animated: true, completion: nil) 

나는 언 와인드 전화를 수동으로 돌아가려면 메뉴 버튼을 누르지 않으면, 그렇게 언 와인드 SEGUE에 대해 뭔가 플레이어가 해제 할 수 허용하지 않습니다 잘 할당을 취소 것으로 나타났습니다. 나는 또한 unwearse segue를 dismissViewControllerAnimated으로 대체하려고 시도했지만 플레이어를 없애고 dealloc은 없어진 것으로 보입니다.

+0

긴장을 푸는 데 문제가있을 수 있습니다. 대신'self? .navigationController? .opViewControllerAnimated (true)'를 사용하여 코드를 테스트했고 대신'deinit'가 호출되었습니다. 자신의 상황에 맞는 것이면'self? .navigationController? .popToRootViewControllerAnimated (true)'라고 부르는 것을 고려해 볼 수 있습니다. 그렇지 않으면 unwind segue가 설정되는 방법을 설명하십시오. – beyowulf

+0

'popToRootViewControllerAnimated'가 작동하지 않으므로 탐색 컨트롤러를 사용하지 않습니다. 나는 unwind to segue를 AVPlayerViewController에서 "unwindToConfig"로 식별하고, 그것은 performSegueWithIdentifier에 의해 트리거된다. 참고로이 [apple guide] (https://developer.apple.com/library/ios/technotes/tn2298/_index.html)와 [이 가이드]의 추가 도움말 (https : //www.andrewcbancroft .com/2015/12/18/working-with-unwind-segues- 프로그래밍 방식으로 신속하게 /) 모든 것을 설정할 수 있습니다. –

+0

'UINavigationController'를 사용하지 않는 이유는 무엇입니까? 당신은'UISplitViewController'를 사용하고 있습니까? 아마도 앱의 구조를 설명 할 수있을 것입니다. – beyowulf

답변

0

방금로드 한 거의 비어있는 파일을 테스트하여 경고를 표시하고 경고 조치 핸들러에서 풀면 괜찮습니다. AVPlayerViewController의 viewDidDisappear 메서드를 추적하여 일부 정리를 재정의했습니다. 이유를 모르겠지만 viewWillDisappear으로 변경하면 문제가 해결되었습니다.