Reputation: 8671
I'm trying to create multiple user accounts at the same time, so I put
Auth.auth().createUser(withEmail: userObj.email, password: userObj.password, completion: {
(user, error) in
in a for loop passing different emails, but it only creates accounts for the last email passed. For example, three accounts with this email: [email protected] if this was the last email passed in a 3-round loop. How can I create multiple accounts at the same time?
Upvotes: 0
Views: 183
Reputation: 598623
The Firebase Authentication SDK for iOS is meant to only create an account for the current user. It is not meant to create accounts for other users, nor to create multiple accounts. If you want this, consider using the Firebase Admin SDK.
If you must run this code in the iOS app, wait for each call to be completed before calling createUser
again.
Auth.auth().createUser(withEmail: email1, password: password1) { (user, error) in
Auth.auth().createUser(withEmail: email2, password: password2) { (user, error) in
Auth.auth().createUser(withEmail: email3, password: password3) { (user, error) in
}
}
}
Upvotes: 1