aslanyanhaik / Quick-Chat

Real time chat app written in Swift 5 using Firebase
MIT License
1.84k stars 360 forks source link

Compile errors #62

Closed capumanGib closed 5 years ago

capumanGib commented 6 years ago

Hi guys,

Awesome project! I've added the firebase stuff, updated with cocoapods etc, but when i try to compile the project i get 3 errors: Value of type 'StorageMetadata' has no member 'downloadURL' Value of type 'AuthDataResult' has no member 'sendEmailVerification' Value of type 'AuthDataResult' has no member 'uid'

Anyone know how to solve those issues?

Tanks

NKesar75 commented 6 years ago

Storage Metadata has been depricatied this stack overflow answer is the new way to make it work the problem is hard to find because firebase didn't update their docs yet. https://stackoverflow.com/a/50464820/9830365 as far as uid and send email verification I haven't used it from authdataresult i get the uid like this let userID = Auth.auth().currentUser?.uid if i find something on email verification ill send it your way

brandonwilliams commented 6 years ago

Any updates, Hector?

NKesar75 commented 6 years ago

Did you try to do this?

Auth.auth().currentUser?.sendEmailVerification { (error) in // ...error do code here }

edbeecroft commented 6 years ago

Hey guys, just a passer by, but here's the changes and their fixes.

1. Value of type 'StorageMetadata' has no member 'downloadURL'

Original code:

if let imageDownloadUrl = metadata?.downloadURL()?.absoluteString {
*handle url*
}

New code:

storageRef.downloadURL(completion: { (url, error) in
if let imageDownloadUrl = url {
*handle url*
})

2. Value of type 'AuthDataResult' has no member 'sendEmailVerification'

Original code: No idea, never used this ;)

New code:

guard let result = user else {
return
}
result.user.sendEmailVerification...

3. Value of type 'AuthDataResult' has no member 'uid'

Original code:

guard let uid = user?.uid else {
return
}

New code:

guard let result = user else {
return
}
let uid = result.user.uid

Hope this helps!

Ed

leak404 commented 6 years ago

i don't fix problem hicccc