Implementing Spil SDK
For this example we create a new small single view application.
Open xcode and create a new project:
Select iOS, application in the left menu and select “Single view application”. Press next:
Name the product: sample and the organization identifier com.spilgames
You can see that the Bundle identifier automatically changes to com.spilgames.sample
Press the play button to build the project for the first time. Make sure the settings right from the play button are the same.
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.
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;
Collapse the Spil.framework and drag the sub frameworks also to the list “Linked Frameworks and Libraries”
Select the “Build settings” tab and search for “linker flag”.
Now add the following flags to the “Other linker flags”:
Search for “bitcode” and set “Enable Bitcode” to “No”
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;
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”.
Select “resource” on the left menu and the file type “property list”
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.
Add the Spil “app group” by adding the following details in the .entitlements file:
Implement the header of the Spil.framework by adding an import in the viewcontroller
Initiate the Spil Framework and enable debugging.
Run the app again and pray.
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:
Now you are ready to use the Spil features.