Facebook FBSDKLoginButtonDelegate loginButton函数语法错误 [英] Facebook FBSDKLoginButtonDelegate loginButton function syntax error

查看:134
本文介绍了Facebook FBSDKLoginButtonDelegate loginButton函数语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode8和swift3.所以我将项目完全转换为最新的语法,现在出现错误:

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

在函数中:

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

FBSDK中的函数声明如下:

The function in FBSDK declared as follows:

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

所以我尝试将错误类型更改为NSError,但出现另一个错误:

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

'SignInViewController'不符合协议'FBSDKLoginButtonDelegate'

'SignInViewController' does not conform to protocol 'FBSDKLoginButtonDelegate'

我不知道该怎么办.任何帮助表示赞赏!

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

推荐答案

我发现我导入了具有自己Error结构的RealmSwift.因此,解决方案是使用Swift.Error而不是仅使用Error.希望这对任何人都有帮助.

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.

这篇关于Facebook FBSDKLoginButtonDelegate loginButton函数语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆