1

Cannot use optional chaining on non optional value 'FIRAuth'

I have tested every solutions, but always got the same error. Even if i create a new project, when i'm using FIRAuth, i always got a compiling error.

Can someone help me please. I use Swift 2, Xcode 7, IOS9

  • Please why are you still you using swift 2, please update to swift 3.0 at least so you could use the new `firebase api`. where you would use `Auth` instead of FIRAuth – Lamour Aug 18 '17 at 22:52
  • I can't upgrade with my mac for the moment, sadly. There is less problems with swift 3 and the Auth class? – sorrynotsorry_nt Aug 19 '17 at 12:57

1 Answers1

3

If you are trying to add FIRAuth.auth()? try to remove (?).

FIRAuth.auth() is non optional so treating them as one might result to the error “Cannot use optional chaining on non optional value 'FIRAuth'”

Optional chaining is a process for querying and calling properties, methods, and subscripts on an optional that might currently be nil

Check Optional Chaining

  • Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. Beyond that your answer rather reads like a mediocre comment, not like a real answer to the question. – GhostCat Aug 29 '17 at 10:46