Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @objc func handleSignup(){
- guard let email = emailTextField.text, email.count > 0 else { return }
- guard let password = paswordTextField.text, password.count > 0 else { return }
- guard let username = usernameTextField.text, username.count > 0 else { return }
- Auth.auth().createUser(withEmail: email, password: password) { (user, err) in
- if let error = err{
- print("Failed to create the user", error.localizedDescription)
- return
- }
- print("The user is successfully created ", user?.user.uid ?? "")
- guard let image = self.buttonView.imageView?.image else{ return }
- guard let uploadData = image.jpegData(compressionQuality: 0.3) else { return }
- print(uploadData)
- let uuid = NSUUID().uuidString
- print("The uuid is \(uuid)")
- print("Coming to here 1")
- Storage.storage().reference().child("profileImages").child(uuid).putData(uploadData, metadata: nil) { (metadata, error) in
- DispatchQueue.main.async {
- print("How about here?")
- }
- if let error = error{
- print("Failed to upload image with \(error.localizedDescription)")
- return
- }
- print("Got here")
- if true {
- print("Got here")
- Storage.storage().reference().child("profileImages").child(uuid).downloadURL(completion: { (url, err) in
- print("in Downloading url \(url) \(err)")
- if let error = err{
- print("There is some error fetching the urls \(error.localizedDescription)")
- }
- guard let downloadurl = url?.absoluteString else { return }
- print("The fetched url is ", downloadurl)
- })
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement