Michel Michel - 9 days ago 5x
iOS Question

How to create multiple PFUsers on Parse-Server?

I am using the

class to handle users (on Heroku/mLab) in an iOS app, using a subclass of
to create news users, one at a time.

It works fine but here is my problem: sometime I want to create multiple users in one go. Say around 50 users in one time.
Obviously I do not want to type them in one by one; I have them ready in a list:

email-01, username-01
email-02, username-02
email-03, username-03
.. etc ..

How can I do that? Is it possible within the iOS app, by some function call?
Or do I need to use some external tool?



I've created a sample project for you, you can sign them up by just using a for loop.

And of course, you can set up all your users in a JSON file, then use JSONSerialization to get the JSON contents.

Here is the sample project:

let userArray = [

@IBAction func signUp(_ sender: UIButton) {
    var index = 0
    for _ in userArray {
        let user = PFUser()
        user.username = userArray[index]["username"]
        user.password = userArray[index]["password"]
        user.email    = userArray[index]["email"]

        index += 1

and there you go, all five users are signed up. enter image description here