This article will teach you how to build your game on a device via Xcode. Please refer to this article to learn how to build on an Android device or how to export your project to Android Studio.
Step 1: Set the Target iOS Version
Go to your iOS Player Settings -> Configuration, and set the target minimum iOS version to 9.0 or higher.
Step 2: Build Xcode Project
Go to File -> Build Settings, select iOS then Build. You should be prompted to locate where you saved the Skillz.framework file.
Note: This Unity cross-platform SDK will only work for Skillz versions 18.0 and above.
Step 3: 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.
If any of these flags are missing, you may encounter linking errors when trying to compile your game with the Skillz framework, or a runtime crash.
Step 4: Check Code Sign on Copy in Embed Frameworks
Go to your project's target and click Build Phases -> Embed Frameworks. Make sure that Code Sign on On Copy is checked for Skillz.framework.
Step 5: Modify supportedInterfaceOrientationsForWindow in UnityAppController.mm
In UnityAppController.mm, find the function supportedInterfaceOrientationsForWindow. Currently this method is returning the following:
return (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationPortraitUpsideDown) | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationLandscapeLeft);
Since Skillz doesn’t support switching orientations between portrait and landscape, you’ll need to modify this function to either portrait only or landscape only.
return (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationPortraitUpsideDown);
return (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationLandscapeLeft);
Step 6: Disable bitcode (if needed)
If you are building on a device, you may run into an error about your game not supporting bitcode. Here’s an example error:
“‘/Skillz.framework/Skillz' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64”
You can disable this by going to your target's Build Settings then setting Enable Bitcode to 'No'.
You should now be able to build on a device via Xcode.
We’re always here to help. Contact firstname.lastname@example.org if you run into any issues.