Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This code blob seems to raise the following error on line 132, I'm a little unsure how to debug:
- Type of expression is ambiguous without more context
- // ANDY: Login with user credentials
- Auth.auth().signIn(withEmail: emailAddress, password: password) { (user, error) in
- // If Successful, pull firstName/lastName
- let ref: DatabaseReference!
- ref = Database.database().reference().child("users").child(emailAddress)
- ref!.observe(DataEventType.value, with: { (snapshot) -> Void in
- // Get user value
- let postDict = snapshot.value as? [String: AnyObject] ?? [:]
- let firstName = postDict["firstName"] as? String ?? ""
- let lastName = postDict["lastName"] as? String ?? ""
- let showroomReference = postDict["showroom"]?["showroomID"] as? String ?? ""
- if showroomReference == ""
- {
- return completionHandler(.failure(Error.unknownShowroom))
- }
- let remoteUser = try User(record: user, context: DatabaseManager.shared.persistentContainer.newBackgroundContext())
- self.fetchShowroom(forIdentifier: showroomReference) { (result) in
- do
- {
- let showroom = try result.value()
- remoteUser.showroom = showroom
- remoteUser.brands = showroom.brands
- completionHandler(.success(remoteUser))
- }
- catch
- {
- completionHandler(.failure(error))
- }
- }
- })
- }
Add Comment
Please, Sign In to add comment