2014-11-17 4 views
0

저는 게임 센터 용 튜토리얼을 Objective C에서 Swift로 번역하려고하는데 현재로드 블록을 맞았습니다. 나는 약 한 시간 찾던 날이 콜백 방법 번역에 도움을 너무 도움이 아무것도 찾을 수 없어이 쉽게 경우 (이것은 아마도)객관적인 C 콜백을 Swift로 번역

- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFailWithError:(NSError *)error { 
[viewController dismissViewControllerAnimated:YES completion:nil]; 
NSLog(@"Error finding match: %@", error.localizedDescription); 

죄송합니다. 나는 스위프트에 익숙하지 않고 도움을 많이 원할 것입니다. 고맙습니다!

답변

1

Apple은 대부분의 설명서를 업데이트하여 API의 Swift 및 Objective-C 버전을 모두 제공하므로 GKMatchmakerViewControllerDelegate methods there을 볼 수 있습니다. 이 기능은 다음과 같습니다.

func matchmakerViewController(viewController: GKMatchmakerViewController!, didFailWithError error:NSError!) { 
    viewController.dismissViewControllerAnimated(true, completion: nil) 
    println("Error finding match: \(error.localizedDescription)") 
} 
+0

오 .. -__- 나는 그것이 쉽게 알고 자신의 의사 사이트에 있었다고 믿을 수 없습니다. 다시 한 번 감사드립니다! – sadfrogger