Andrey M. Andrey M. - 9 months ago 122
Swift Question

Facebook FBSDKLoginButtonDelegate loginButton function syntax error

i'm using Xcode8 and swift 3. So I fully converted my project to the latest syntax and now i get the error:

'Error' is ambiguous for type lookup in this context

in the function:

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

The function in FBSDK declared as follows:

- (void) loginButton:(FBSDKLoginButton *)loginButton
didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result
error:(NSError *)error;

so I tried to change Error type to NSError but i get the other error:

'SignInViewController' does not conform to protocol 'FBSDKLoginButtonDelegate'

I don't know what to do. Any help is appreciated!


I found that i've imported RealmSwift that have their own Error struct. So the solution is to use Swift.Error instead of just Error. Hope this helps to anybody.