Guest User

Untitled

a guest
Feb 1st, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. This code blob seems to raise the following error on line 132, I'm a little unsure how to debug:
  2. Type of expression is ambiguous without more context
  3.  
  4. // ANDY: Login with user credentials
  5. Auth.auth().signIn(withEmail: emailAddress, password: password) { (user, error) in
  6. // If Successful, pull firstName/lastName
  7. let ref: DatabaseReference!
  8. ref = Database.database().reference().child("users").child(emailAddress)
  9.  
  10. ref!.observe(DataEventType.value, with: { (snapshot) -> Void in
  11. // Get user value
  12. let postDict = snapshot.value as? [String: AnyObject] ?? [:]
  13. let firstName = postDict["firstName"] as? String ?? ""
  14. let lastName = postDict["lastName"] as? String ?? ""
  15. let showroomReference = postDict["showroom"]?["showroomID"] as? String ?? ""
  16.  
  17. if showroomReference == ""
  18. {
  19. return completionHandler(.failure(Error.unknownShowroom))
  20. }
  21.  
  22. let remoteUser = try User(record: user, context: DatabaseManager.shared.persistentContainer.newBackgroundContext())
  23.  
  24. self.fetchShowroom(forIdentifier: showroomReference) { (result) in
  25. do
  26. {
  27. let showroom = try result.value()
  28. remoteUser.showroom = showroom
  29. remoteUser.brands = showroom.brands
  30.  
  31. completionHandler(.success(remoteUser))
  32. }
  33. catch
  34. {
  35. completionHandler(.failure(error))
  36. }
  37. }
  38. })
  39. }
Add Comment
Please, Sign In to add comment