신속한 스프라이트 키트 게임에서 Game Center를 설정하려고합니다. 내 응용 프로그램 위임게임 센터 인증 처리기보기 컨트롤러가 항상 0입니다.
func authenticateLocalPlayer(){
let localPlayer: GKLocalPlayer = GKLocalPlayer.localPlayer()
localPlayer.authenticateHandler = {(viewController : UIViewController!, error : NSError!) -> Void in
//handle authentication
if (viewController != nil){
self.window?.rootViewController?.presentViewController(viewController, animated: true, completion: nil)
}
else{
if (localPlayer.authenticated){
gameCenterEnabled = true
//Get the default leaderboard identifier.
localPlayer.loadDefaultLeaderboardIdentifierWithCompletionHandler({ (leaderboardIdentifierr: String!, error: NSError!) -> Void in
if (error != nil){
NSLog("%@", [error.localizedDescription])
}
else{
leaderboardIdentifier = leaderboardIdentifierr
}
})
}
else{
gameCenterEnabled = false
}
}
}
}
에서 수행되는 다음과 같은 오전 데 문제는 localPlayer.autheniticateHandler 항상 내 로컬 플레이어가 인증되지 않은 경우에도 전무의 ViewController를 반환한다는 것입니다. 내가 뭘 잘못하고 어떻게 수정해야하는지 알려주세요.
감사합니다. 아마이 대답 없이는이 일을 결코 얻지 못했을 것입니다. – Michael