Quickstart

Step 1 – Downloading Parse SDK

The first step is to download the latest version of the Parse SDK at the Open Source project at GitHub.

At this tutorial, we will use the Parse SDK 1.14.2 but at any time you can update your SDK visiting the same page.

ParseSDK-iOS

Click here to download the SDK 1.14.2 directly.

Extract the SDK files at your project root directory.

 

Step 2 – Add Parse SDK libs to your XCode project

After downloading the SDK, we need to import them on your APP Project on XCode and Add the dependencies.

To keep your project visually organized you can create a folder ( at this tutorial we have created a folder called Frameworks). Right-click over your project and then select New Group. After give your Parse SDK Lib a name.

 

iOS-SDK-CreateGroup

Now select your SDK files Parse and Bolts then drag & drop them at your Group.

iOS-SDK-import

Confirm the reference creation on your APP Project.

iOS-SDK-reference

 

Now let’s add the dependencies.

Click on Targets → Your app name → and then the ‘Linked Frameworks and Libraries’ tab.

ios-sdk-dependencies

 

At the dependencies window, add the following libraries:

  • AudioToolbox.framework
  • CFNetwork.framework
  • CoreGraphics.framework
  • CoreLocation.framework
  • QuartzCore.framework
  • Security.framework
  • StoreKit.framework
  • SystemConfiguration.framework
  • libz.tbd
  • libsqlite3.tbd

Note: This is a comprehensive list of dependencies for a typical app. You may be able to omit some of these if you are not using the -ObjC linker flag or if you do not plan to implement Location Services or In-App Purchases, for example.

Step 3 – Connect your App to back4app (Parse Server)

Open up your AppDelegate.swift and update it like so:

import Parse
import Bolts
 
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
 
  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Initialize Parse.
    let configuration = ParseClientConfiguration {
        $0.applicationId = "YOUR_APP_ID"
        $0.clientKey = "YOUR_CLIENT_KEY"
        $0.server = "https://parseapi.back4app.com"
    }
    Parse.initializeWithConfiguration(configuration)

    // ...
}
 
// ...
To get this information go to back4app.com and, after login, click on Features -> Core Settings -> Server. Then copy and Paste your APP_ID and your CLIENT_KEY to your code.
ios-sdk-app-id
The final code will be like that:
ios-sdk-code

 

Step 4 – Test the SDK

First, make sure to include our SDK imports at the top of your .swift files:

import Parse

Then copy and paste this code into your app, for example in the viewDidLoad function (or inside another function that gets called when you run your app):

let testObject = PFObject(className: "TestObject")
testObject["foo"] = "bar"
testObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
  print("Object has been saved.")
}

Run your app. A new object of class TestObject will be sent to the back4app and saved.

ios-sdk-view-controller

Run your project and see the message: Object has been saved on your XCode Debug area.