Sign-up/Sign-in - ObjC
This section explains how you can create an app with a simple user registration using Parse Server core features through Back4App.
This is how it will look like:
At any time, you can access the complete Project built with this tutorial at our GitHub repository.
To complete this quickstart, you need:
- An app created at Back4App.
- An iOS app connected to Back4App.
- Note: Follow the Install Parse SDK (ObjC) Tutorial to create an Xcode Project connected to Back4App.
- A paid Apple Developer Account.
- Add another view controller called LoggedInViewController. In the main storyboard drag a view controller on to the canvas and set the class to LoggedInViewController and set the Storyboard ID to LoggedInViewController
- In both ViewController.m and LoggedInViewController.m make sure to include the Parse module by including it at the top of the file.
Logging in creates a Session object, which points to the User logged in. If login is successful, ParseUser.CurrentUser() returns a User object, and a Session object is created in the Dashboard. Otherwise, if the target username does not exist, or the password is wrong, it returns null.
The method used to perform the login action is ParseUser.logInWithUsername(), which requires as many arguments as the strings of username and password, and may call a callback function.
Note: After signing up, login is performed automatically.

- Drag four UITextFields onto the ViewController in the main storyboard. Center the textfield and put two at the top and two at the bottom of the view controller. Drag two more UIButtons on to the view and place them below the textfields. Set the top button text to say Sign In. Set the bottom bottom to say Sign Up. Set the text fields to say username and password. It should look like this.
- 2. Next we are going to connect your UITextFields in your storyboard to properties in your view controller. Add the following properties to the top of ViewController.m. Next go to your storyboard and right click on each UITextField and click on the reference outlet then drag a line back to the ViewController icon and set it to the appropriate field. signInUsernameField connects to the sign In Username Field, etc… Finally we will add a UIActivityIndicatorView for later.
2. Then in the viewDidLoad method set the UIActivityIndicatorView to be attached to the middle of the screen.
3. Then in the viewDidAppear method check to see if you are already logged in. If you are logged in you will redirect the user to the LoggedInViewController.
4. Next lets add the goToMainPage method. It will redirec the user to the LoggedInViewController. Make sure the that the LoggedInViewController in the storyboard has its class and Storyboard ID set to LoggedInViewController.
5. Now lets set up the IBAction that will connect to the SignUp button on the ViewController in the main storyboard.
6. We need to add the displayErrorMessage function to show any error messages from the server. We will use this method anytime we communicate with our parse app.
7. Now that we can handle network activity and network errors lets set up the IBAction that will connect to the SignIn button on the ViewController in the main storyboard.
Logging out deletes the active Session object for the logged User. The method used to perform log out is ParseUser.logOutInBackgroundWithBlock().
- Drag a UIButton on to LoggedInViewController in the main storyboard. Set the button title to ‘Logout’. It should look like this.
- Lets add the displayErrorMessage function again to show any error messages from the server. We will use this method anytime we communicate with our parse app.
2. Lets add the goToStartPage function to take us back to the login/signup screen after we logout.
3. Finally lets add the IBAction to execute the logout call and take us back to ViewController.m signup/login page. This method logs out the PFUser and takes you back to the signup page. Connect this IBAction to the logout button on LoggedInViewController.
- Run your app and create a couple of users, also try logging in again after registering them.
- Find your app and click on Dashboard>Core>Browser>User.
- Try logging in and out with the same user and signing back in.
At this point, you should see your users as displayed below:
Note: Using the codes displayed above, every time you log in with a user, a Session is opened in your Dashboard, but when the user logs out that particular Session ends. Also, whenever an unsuccessful login or sign up attempt occurs, the Session opened in Parse Server Dashboard is deleted.
At this stage, you can log in, register or log out of your app using Parse Server core features through Back4App!