Error about synchronous http requests when registering user

I am trying to use Backendless to register a user in my React Native iOS app, so I followed the JavaScript documentation (quick start guide) for creating a user. After initializing the Backendless object, I use the following code:

var user = new Backendless.User();
user.email = this.state.email;
user.password = this.state.password;
user.firstName = this.state.firstName;
user.lastName = this.state.lastName;
Backendless.UserService.register(user);

When running the code I get an error saying “Synchronous http requests are not supported”, stemming from the last line in the above code. I’m not quite sure what that means. Is that not the proper way to registert a user? Am I doing something wrong in my code? The mention of synchronous requests makes me think I have to use something that returns a promise, but there was no mention of that in the documentation I read. I’ve attached a screenshot of the error that points to some lines in the Backendless code, in case that helps.

Thanks in advance.

Didn’t see the file attached to the first message for some reason, so trying again here.

The error means you’re using the synchronous version of the API. The documentation is very clear about synchronous and asynchronous signatures:

https://backendless.com/documentation/users/js/users_user_registration.htm

You need to use the async argument which is an instance of the Backendless.Async object. The example on the same page demonstrates the usage.

Thank you for the tip Mark. As I mentioned, I was using the JavaScript quick start guide (https://backendless.com/mobile-developers/quick-start-guide-for-javascript/), which does not say anything about synchronous and asynchronous signatures. I took a look at the documentation you provided and it worked. Thanks.