Making Social Media App using Parse

HelloMeets
5 min readJul 11, 2016

--

What’s the process of creating a mobile application with the help of Parse?

We are going to use swift and develop an iOS application, however, you can also use it develop Apps for Android or Windows platforms too.

So, first let me introduce you to Parse.

We provide a suite of cloud services for developers that are tightly coupled with SDKs for all the major client platforms — Ilya Sukhar, Parse CEO

In layman’s language—

· Parse is cloud application platform which provides SDKs for building mobile backends for various mobile platforms.

· With Parse, you can add a scalable and powerful backend in minutes and launch a full-featured mobile or web App in record time without ever worrying about server management.

· Parse offers push notifications, social integration, data storage, and the ability to add rich custom logic to your Apps backend with Cloud Code.

Now let me tell you the steps involved in making a Social Media Mobile app with Parse:

1. Setting up a new App on Parse and Installing the Parse SDK.

2. Onboarding and Facebook integration.

3. Displaying and Editing the User Profile.

4. Creating a new post.

5. Creating the home feed.

6. Following and Blocking other users.

7. Parse Local Datastore.

8. Setting up a Parse Server.

Now we are going to go in some detail to understand how to implement these steps.

Setting up a new app on Parse.

  • Create a new app on your Parse Dashboard.
  • Create a new XCode Project with a ‘Single View App’ template.
  • Use either CocoaPods or download the SDK and add it manually.
  • Import Parse on the top of every source file.
  • Download the SDK from this link — SDK.
  • Add the .framework files in your project (Bolts, Parse, ParseUI, etc).
Parse Dashboard

Onboarding and Facebook integration

  1. User Onboarding

Log In-

PFUser.logInWithUsernameInBackground(/*username*/, password: /*pass*/, block: {…})

Sign In-

user.username = /*username*/, user.password = /*password*/, user.signUpInBackgroundWithBlock({…})

2. Facebook & Parse Integration

  • Set up a Facebook Developer Account- Link.
  • Installing the Facebook SDK- Link.
  • Add the FBSDKLoginKit, FBSDKShareKit, and FBSDKCoreKit frameworks.
  • To log in using Facebook you need to enable some permissions on your Facebook developer account by requesting access to these from Facebook.

Displaying and Editing the User Profile.

  1. Displaying info

For non empty fields —

nameLabel.text = currentUser!.username!

2. Updating info

For updating the name, the code goes as —

if nameField.text!.characters.count > 1 { currentUser![“name”] = nameField.text }

Creating a new post.

  1. Creating a new table in Parse
  • Open the Parse Core dashboard, and add a new table.
  • Add new columns with their types to best model your data.
  • Keep a column to link each post with its user — for the news feed.

2. Add and Save a new post

  • Have the appropriate conditions set to validate the data before saving.
  • Good idea to have the option to share the post on other social platforms as well.

Creating the home feed.

  • PFQueryTableViewController: used to display a table of objects from Parse.
  • Other use cases: Notifications list, friend list, search results, etc.

Following and Blocking other users.

  1. Setting up the Follow Table:
  • Two mandatory columns: ‘from’ and ‘to’ — Pointers to the User class.
  • Can combine it with the Activity table. Conglomerates all information needed for the notifications list in a common place.

2. Search Facebook Friends:

  • Check Facebook Permissions.
  • Send Graph Request at /me/friends.
  • Retrieve Facebook IDs from result.
  • Get Parse users with Facebook IDs.

For setting up the Block Table — follow similar instructions as the follow table, and pass queries which return users through the function.

Parse Local Datastore

Parse Local Datastore is a feature in the Parse SDK that lets you to take your app offline with just a few simple lines of code.

ParseObject#pin() adds ParseObjects to the Local Datastore and ParseObject#unpin() removes them. Once pinned, you can access them anytime with a normal ParseQuery.

Using the Local DataStore:

  • Parse.enableLocalDatastore() before setting the Application ID in AppDelegate.swift.
  • Use the pin() and pinInBackground() methods of the PFObject class for local saves.
  • Use the fromLocalDatastore() method of the PFQuery class for local queries.

Setting up a Parse Server

Parse Server is an open source version of the Parse backend that can be deployed to any infrastructure that can run Node.js.

We also have a dedicated blog post on Parse Server and why is it still one of the best backend services around. You can find the blog here- Parse Server.

Since, there’s not much time left for Parse, we need to migrate to Parse Server as soon as possible. We have a detailed tutorial on how to make a smooth transition in the blog mentioned above.

All this was discussed at @HelloMeets Parse workshop with our trainer Tanay Kothari.

Upcoming Workshops at @ HelloMeets —

Google Analytics Workshop — 16th July | 3pm to 7pm

How should Developers & Designers work together to Speed up the work? — 17th July | 10 am to 4 am

Content Marketing Workshop — 17th July | 3pm to 7pm

Author : Ishmin Singh, Content Writer HelloMeets

--

--

HelloMeets

Where like-minded people meet over meaningful conversations