Getting Started

The content in this guide refers to the newly released version 3 of the library. You can still access the version 1.x guides here.

Version 1.x is now deprecated. We will continue to support 1.x through March 31, 2017 (End of Support - EOS). If you are currently using 1.x in your apps, you will need to upgrade your apps to 3.x before the EOS date. We have created a migration guide to help you.

This guide walks you through setting up your app with Kinvey.

Prerequisites

  • Xcode 8.1 or above.
  • iOS 9 or above.
  • Swift 2.3 or above. Refer to the download page for the Kinvey version that matches your preferred Swift version.

Setup Kinvey

You can start using the Kinvey framework in one of three ways - using CocoaPods, using the Kinvey starter app, or using the SDK source code.

Using CocoaPods

If you are using CocoaPods, add the Kinvey Pod to your target in the Podfile.

pod `Kinvey`

For a target called MyProject, your Podfile will look like this:

target 'MyProject' do

  pod 'Kinvey'

end

From the Terminal, run pod install in the project folder to install the dependency.

If you are using Swift 2.3, you will need to use Kinvey version 3.2.x.

pod 'Kinvey', '~> 3.2.1'

Using the Starter App

You can get started with the Kinvey iOS starter app. The starter app is bundled with the Kinvey framework.

We recommend updating the Kinvey framework in the app to the latest available on our downloads page before you begin.

Using SDK Source Code

The Kinvey iOS SDK is open source. If you prefer to compile your app against the SDK source code, you can follow the instructions on our github repo to set up the SDK.

Initialize Kinvey Client

Before you can communicate with the backend, you need to give the library your app key and secret. This is done with the following code snippet, substituting your app's key and secret (found in the management console header when viewing your app backend). We recommend adding this to your AppDelegate's application:didFinishLaunchingWithOptions: method.

import Kinvey

Kinvey.sharedClient.initialize(
    appKey: "<#Your app key#>",
    appSecret: "<#Your app secret#>"
)

Customers with dedicated Kinvey instances will need to set the apiHostname to your dedicated Kinvey host URL.

You can find the host URL in your console dashboard, next to your App Key and App Secret.

//Set the apiHostName to a sample url.
//Replace the sample url with the url for your dedicated Kinvey backend.
Kinvey.sharedClient.initialize(
    appKey: "<#Your app key#>",
    appSecret: "<#Your app secret#>",
    apiHostName: NSURL(string: "<#https://my-url.kinvey.com/#>")!
)
//Set the apiHostName to a sample url.
//Replace the sample url with the url of your dedicated Kinvey backend.
Kinvey.sharedClient.initialize(
    appKey: "<#Your app key#>",
    appSecret: "<#Your app secret#>",
    apiHostName: URL(string: "<#https://my-url.kinvey.com/#>")!
)

Every App has an Active User

Your app will be used by a real-life human being. This person is represented by the Active User. This user object must explicitly be created, either with a username and password, OAuth sign-on (such as Facebook, Google+, LinkedIn, etc.), or Mobile Identity Connect. See the User Guide for more information.

What's next

You are now ready to start building your awesome apps! Next we recommend diving into the User Guide or Data Store Guide to learn more about our service, or explore the sample apps to go straight to working projects.

Got a question?