Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 3: ViewController does not conform to protocol GIDSignInDelegate #267

Closed
bennettl opened this issue Oct 4, 2016 · 10 comments
Closed

Comments

@bennettl
Copy link

bennettl commented Oct 4, 2016

Describe your environment

Swift 3.0
Xcode 8
GoogleSignIn 4.0.0

Describe the problem:

Xcode keeps telling me my view controller does not conform to protocol, when I literally copy and paste the required function into my view controller. It's saying that I'm missing the method that I clearly have in my view controller (double checked method name, parameter types, etc.)

Steps to reproduce:

  1. Upgraded to Swift 3.0, Xcode 8
  2. Make View controller conform to protocol GIDSignInDelegate
  3. Place the method in view controller:

public func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {}

or
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {}

Observed Results:

screen shot 2016-10-03 at 11 42 21 pm

Expected Results:

My app to build successfully because I followed the protocol.

@ianbarber
Copy link
Contributor

That's an odd one! Looks like the type of Error is getting inferred wrong - I see UIViewController.Error which is odd, as it should be an NSError.

You might be able to force it - try declaring the protocol as Swift.Error (or maybe GoogleSignIn.Error).

@happiehappie
Copy link

But will there ever be an updated example for swift 3?

@mahesh-brainvire
Copy link

I am getting same error

@happiehappie
Copy link

Guess this issue is dead XD

@evelynklassen
Copy link

I'm getting the same error. Has anyone managed to solve it?

@happiehappie
Copy link

Try check the documentation again. It seems to be updated.

@evelynklassen
Copy link

evelynklassen commented Jan 27, 2017

I checked the documentation, but I'm still facing the same error.

The documentation says to use:
func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!)
But the protocol is:
public func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!).

My environment:
Xcode 8.2.1
Swift 3.0.2
GoogleSignIn 4.0.1

UPDATE
I found the error. I had a model with the name "Error", it was probably conflicting with GoogleSignIn.

@edurd
Copy link

edurd commented Aug 4, 2017

@evelynklasse You just saved my day with that UPDATE, thanks!

@samtstern
Copy link
Contributor

Looks like @evelynklassen solved this a while ago and we forgot to close it.

@dmobisoft
Copy link

I found the error. I had a model with the name "Error", it was probably conflicting with GoogleSignIn. I had remove Error class and it's working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants