2016-09-19 59 views
0

我正在將我的應用程序遷移到Swift 3,並且遇到此問題。一直停留幾個小時,似乎沒有任何幫助類型不符合協議,但它確實 - 遷移到Swift 3

enter image description here

這裏是我的代碼,它是可見的是我遵守該協議。

func loginButtonWillLogin(_ loginButton: FBSDKLoginButton!) -> Bool { 
    return true; 
} 

func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) { 
} 

func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) { 

    if (error != nil){ 

    } else if (result.isCancelled){ 

    } else { 
     navigationController?.pushViewController(ContainerScreen(), animated: false); 
    } 
} 

任何我可以嘗試前進的東西?謝謝。

+0

聽起來就像你在'UIViewController'的擴展中定義了一個嵌套類型'Error',它與stdlib的'Error'協議衝突 - 這是真的嗎? – Hamish

+0

不,我的項目中沒有UIViewController的擴展。 –

+2

呃,很奇怪。如果你的CMD +在你的'loginButton'方法刪除中點擊'Error',Xcode會帶你去哪裏? – Hamish

回答

1

您的didCompleteWith方法有一些問題,看起來它在完成時有多個參數。但你只有兩個。

func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith completion : (button : FBSDKLoginButton, result : FBSDKLoginManagerLoginResult, error : Error) ->() { 

} 

我沒有這裏正確的語法,但我認爲你有這個概念。你的完成必須有三個參數,你錯過了FBSDKLoginButton

+0

謝謝你爲你的答案。我似乎無法找到合適語法的文檔,而且我目前無法調試該項目,因爲我遇到了一些cocoapods問題,但只要我可以嘗試解決方案,我就會發表評論。 –

相關問題