iOS Install Framework

Install Framework

Before you can integrate the Skillz SDK into your game, you must first properly add it to your Xcode project. For this and all future articles, we require the use of Xcode 8.

These documents use Objective-C, but they also apply to Swift projects; refer to Swift only. If your project uses Cocoapods, Skillz has a pod that makes installing the framework much easier.

 

Step 1: Add the Skillz SDK to your Xcode project

Drag the Skillz.framework file into your project.

Figure 1: Drag and drop into your project

Dragging the Skillz SDK into Framework

Important: When adding the Skillz.framework make sure that the Copy groups option is selected.

Figure 2: Proper copying into Xcode

Copy groups example

Skillz.framework contains everything needed for Skillz to operate. Your project should now contain the Skillz SDK.

Figure 3: Copied into Xcode

The Skillz SDK in the Frameworks group

 

Step 2: Set the Deployment Target

You’ll next need to ensure that your Deployment Target is set to 8.0, which is the minimum iOS version the Skillz SDK is compatible with.

This can be set by editing the your project build settings by double clicking on your project’s root entry, selecting the General tab, and edit the Deployment Target.

Figure 4: Setting the deployment target

 

Step 3: Update Embed Binaries Build Step

This new framework will need to be embedded in your app via Xcode’s Embed Binaries build setting. This setting can be found under the General settings page of your app target.

Figure 5: Embedding a Dynamic Library

Embed Binary

The Skillz.framework should then be listed under both the Link Binary With Libraries build phases step, and the new Embed Frameworks build step as seen below.

Figure 6: Ensure library is linked and that Code Sign On Copy is checked

Link Binary

 
Note: This error will occur if Code Sign on Copy is not checked
 
Screen_Shot_2017-06-07_at_11.33.20_AM.png

Step 4: Add Required Linker Flags

Skillz requires five linker flags which must be set in your Xcode project. The required linker flags are:

-ObjC -lc++ -lz -lsqlite3 -lxml2 -weak_framework PassKit

To set these flags, go to your project target in Xcode. In the Linking section in Build Settings, specify any missing flags in the Other Linker Flags setting.

Figure 7: Linker flags set

If any of these flags are missing, you will encounter linking errors when trying to compile your game with the Skillz framework.

 

Step 5: Add the Skillz run script

The final configuration step is to add a Skillz specific script to the Build Phases of your project.

Go into your project target in Xcode. Select the Build Phases section and click the + sign to add a New Run Script Phase.

Figure 8: Creating a run script

Confirm the shell is set to /bin/sh and paste the following in the box,

if [ -e "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Skillz.framework/postprocess.sh" ]; then
    /bin/sh "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Skillz.framework/postprocess.sh"
fi

Ensure that this run script is the last item in Build Phases.

This script will add a standard NSLocationWhenInUseUsageDescription property to your project’s Info.plist if it isn’t already present. If this property already exists, we recommend updating the description string to reflect that cash gameplay requires location information for legal reasons.

 

Next Steps

After completing these steps, the Skillz SDK should be properly included in your project and you should be able to compile your game without errors.

The next step is to perform the actual integration!