iOS setup

This guide will walk you through a step-by-step process to set up a basic iOS project using the Gamedonia Backend Platform.

Get the iOS Gamedonia SDK

Log in to Gamedonia and get the SDK at the Download Area. We recommend checking the SDK version, as we're regularly updating them.

Integrate game with backend

Setup Xcode Project

  1. Unzip the downloaded GamedoniaSDK.framework.zip.

  2. Drag the GamedoniaSDK.framework to your Xcode frameworks folder.

  3. Select Copy items into destination group's folder.

  4. Validate that the libraries will be added to your main build target (In the screenshot the Sample target).

  5. Select your project main folder, go to Build Phases > Link Binary with Libraries and click on +.

  6. Search for StoreKit, select StoreKit.framework and click on Add.

Create a Game in Gamedonia

We need to create a game in the Gamedonia Dashboard to be able to continue. The Dashboard is the developer tool that will allow you to manage all the related modules of the game. Now let's see how we can create a Game.

  1. Click the Add New backend button.

  2. Write the name of your new backend, select the platform and press Save when ready, your game will be created inmediately and will be ready to start communicating with your game client.

Initializing the SDK Client

To enable the GamedoniaSDK in your app you need to complete the initialization process with a simple call to a function.

  1. Include the Gamedonia SDK header file in your code to be able to use the SDK.  To import the header you can use:

    #import <GamedoniaSDK/Gamedonia.h>
    
  2. Call initialize:secret:apiServerUrl:apiVersion. This function takes four arguments. The game Api Key, game Secret, Api Server Url and the Api Version.

    Example initialization call

    [Gamedonia initialize:@"<your-api-key>" 
               secret:@"<your-shared-secret>" 
               apiServerUrl:@"http://api.gamedonia.com" 
               apiVersion:@"v1"
    ];
  3. Replace your-api-key and your-shared-secret with the values in Game Management > Information page.

When developing your app for the App Store or Google Play or whatever public market you should use the normal key that will respect all the security policies defined in your app. Use this as your default.

The master key lets you override permissions and access all entities and collections in the game, ignoring their Read/Write permissions.

User Authentication

Now your app is ready to perform calls to Gamedonia Backend!

You may be wondering what could be the first thing to do now that you have access to your own game backend. Why not create a User and log him in? You will need a logged in user (valid Gamedonia session) to invoke most of the Gamedonia API calls.

Create your first user

We will start with an easy example, where we create a user with email credentials ( email and password ). Here's how to create a user with iOS.

Login a user

The call to log in a user is the one that gets you a session token and, with it, the authentication to perform the rest of the API calls of the Gamedonia API. The credentials must be the ones of a created user at the Users collection. See how to log in a user with iOS.