2017-01-24 1 views
0

나는 객관적인 C 코드를 신속하게 번역하려고 노력 중입니다. 지금까지했지만 일부 오류가 발생했습니다. 어떤 도움을 주셔서 감사합니다.swatch에서 dispatch_async 번역

내가 이런 식으로 한 빠른 버전
dispatch_async(dispatch_get_main_queue(), ^{ 
     [self.window.rootViewController presentViewController:self.incomingCall animated:YES completion:nil]; 

하지만 난 오류 얻을 :

dispatch_async(dispatch_get_main_queue(), {() -> Void in 
      // Show the alert 
      self.window?.rootViewController?.present(self.iincomingCall(), animated: true, completion: nil) 
     }) 
+0

입니다? 스위프트 버전은 무엇입니까? 2 또는 3? – rmaddy

+0

Swift 3을 사용하는 경우 http://stackoverflow.com/questions/37801370/how-do-i-dispatch-sync-dispatch-async-dispatch-after-etc-in-swift-3?rq=1을 참조하십시오. – rmaddy

답변

2

스위프트 3 구문 오류가 무엇

DispatchQueue.main.async { 
     //your code 
} 
+0

은 다음과 유사해야합니다. DispatchQueue.main.async (실행 : { self.window? .rootViewController? .present (self.iincomingCall(), animated : true, 완료 : nil) } – user7430661

관련 문제