+31 (0) 20 760 2040 info@spilgames.com

Implementing Spil SDK

Creating a new project
For this example we create a new small single view application.
Open xcode and create a new project:

sdk1

Select iOS, application in the left menu and select “Single view application”. Press next:

sdk2

Name the product: sample and the organization identifier com.spilgames
You can see that the Bundle identifier automatically changes to com.spilgames.sample

sdk3

Press the play button to build the project for the first time. Make sure the settings right from the play button are the same.

sdk4

If everything went ok you can see the simulator starting up the application with a simple white screen.

Download and Import the Spil iOS SDK into your project

You can find the latest version of the Spil iOS SDK here:
https://github.com/spilgames/spil-ios-sdk

Drag the Spil.framework into your xcode project (the “project inspector window”) on the left side right under the “sample” folder. Select copy items if needed.

sdk5
sdk6

In the general tab we will add the frameworks the Spil SDK requires. Add them by pressing the + sign under the section “Linked Frameworks and Libraries”.
Frameworks: StoreKit; SystemConfiguration; MediaPlayer; CoreTelephony; CoreGraphics; CoreLocation; AdSupport; QuartzCore; AudioToolbox; AVFoundation; CoreMedia; EventKit; EventKitUI; MediaPlayer; MessageUI; WebKit; AssetsLibrary; MapKit; Twitter; Accounts; Social; CoreMotion; libxml2; libz;

sdk7

Collapse the Spil.framework and drag the sub frameworks also to the list “Linked Frameworks and Libraries”

sdk8

Select the “Build settings” tab and search for “linker flag”.
Now add the following flags to the “Other linker flags”:

sdk9

Search for “bitcode” and set “Enable Bitcode” to “No”

sdk10

Select the “Info.plist” file. Right click on a key and select “Show raw Keys/Values” and add the “Transport Security Settings” as shown in the image;

sdk11sdk11_1

Add the unityAds.bundle file to the project as well;

Adding a group normally happens in the capability tab. However since your xcode is not linked with our Spil Games account (you should not have the credentials) we need to add it manually.
Right click on the “sample” folder and select “create new file”.

sdk12

Select “resource” on the left menu and the file type “property list”

sdk13

Name the file sample.entitlements.
Note: the name of the .entitlements file needs to be the same as your project name.

Edit the sample.entitlements file to match exactly as below.

sdk14

Add the Spil “app group” by adding the following details in the .entitlements file:

sdk15

Implement the header of the Spil.framework by adding an import in the viewcontroller

sdk16

Initiate the Spil Framework and enable debugging.

sdk17

Run the app again and pray.

sdk18

When everything went ok you should see a whole bunch of logs in the console. By looking at the logs you can validate the implementation by for example the App group user id is highlighted in the example below:

sdk19

Now you are ready to use the Spil features.