title: Firebase iOS Phone Authentication: failure to verify phone number
body: <p>I am trying to do authentication on iOS with Firebase and phone numbers.</p>
  
  <p>The issue I found through the print statements is with SubmitPhoneNumber(). It hits the "we found an error" print statement and the error being reported is </p>
  
  <p>FIRAuthErrorUserInfoNameKey=ERROR_INVALID_PHONE_NUMBER as well as </p>
  
  <p>FIRAuthErrorUserInfoNameKey=ERROR_WEB_CONTEXT_ALREADY_PRESENTED</p>
  
  <p>I am not sure what to make of this or how to go about fixing this. The format for the phone numbers I am passing is "+[country code]1234567890"</p>
  
  <pre><code>import SwiftUI
  import Firebase
  
  struct VerifyPhoneView: View {
  
      private var phoneNumber: String = ""
      @State private var verificationID: String = ""
      @State private var verificationCode: String = ""
      @State private var loginSuccesful: Bool = false
      @EnvironmentObject var ls: LoginStatus
  
      init(phoneNumber: String) {
          self.phoneNumber = phoneNumber
          submitPhoneNumber()
      }
  
      var body: some View {
  
          ZStack {
  
              Text("My code is")
  
              TextField("Enter code", text: $verificationCode)
  
              Button(action: {
                  self.submitVerificationCode()
              }) {
                  Text("Continue")
              }
  
          }
  
      }
  
      func submitPhoneNumber() {
          print("the submitPhoneNumber method was called")
          PhoneAuthProvider.provider().verifyPhoneNumber("+1" + phoneNumber, uiDelegate: nil) { (verificationID, error) in
              if error != nil {
                  print("we found an error")
                  print(error?.localizedDescription)
                  return
              }
              else {
                  print("we did not find an error")
                  print(verificationID!)
                  self.verificationID = verificationID!
              }
          }
      }
  
      func submitVerificationCode() {
          print ("222 verificationID is " + self.verificationID)
  
          let credential = PhoneAuthProvider.provider().credential(
              withVerificationID: self.verificationID,
              verificationCode: self.verificationCode)
  
          Auth.auth().signIn(with: credential) { (user, error) in
              if let error = error {
                  print(error.debugDescription)
                  return
              }
              // User is signed in
              print("User signed in succesfully")
          }
      }
  
  
  
  }
  </code></pre>