ReplayKit을 사용 중입니다. 취소 또는 저장 버튼을 누르면보기 컨트롤러가 닫히고 광고를 게재하고 싶습니다. 문제는 광고가 표시되지 않고이 오류가 발생한다는 것입니다. 문제를 해결하려면 어떻게해야합니까? 감사!보기 컨트롤러를 삭제 한 후 내 Facebook 삽입 광고를 게재 할 수없는 이유는 무엇입니까?
Warning: Exception caught during invocation of received message, dropping incoming message and invalidating the connection. Exception: This method must be called on the main thread
internal func previewControllerDidFinish(previewController: RPPreviewViewController) {
previewViewController.dismissViewControllerAnimated(true, completion: nil)
NSNotificationCenter.defaultCenter().postNotificationName("loadAd", object: nil)
}
예외의 완료 블록의 알림을 게시 할 수있는이 방법은 주 스레드에서 호출해야합니다. GCD를 사용하여 메인 스레드로 함수를 디스패치 할 수 있습니다. 그건 그렇고 사용자 인터페이스는 메인 스레드로 업데이 트해야합니다. 스위프트 3 사용을 위해 –
'DispatchQueue.main.async { // 여기에 코드를 삽입 }' –