This quick tutorial will show you how to set up your Unity project to build for the iOS platform.
Make sure your Application Identifier is correct for the API Key you’re using. You can find your project’s Application Identifier by clicking the Set App ID button on the
Kudan Trackerscript, or by going to Edit -> Project Settings -> Player and opening Other Settings in the iOS tab.
Your Application ID be either:
- The ID you entered when generating your free key on the Kudan website, in the format “com.companyName.productName”.
- If you are using the Development License Key,
To see if your API Key is valid for the Application ID you put in, run the app in Play Mode. A message will print out in the console telling you whether or not your API Key is valid.
If your Application Identifier is not correct, the tracker will not run.
Camera Usage Description
Add a camera usage description in the appropriate field. Since Kudan uses the camera, the app will crash on iOS 10+ if an app does not contain a usage description. The message can be anything you like, as long as it isn’t empty.
If you add any extra features to your app that require additional hardware components, such as GPS, remember to add usage descriptions for those to save yourself a headache later.
Build the Xcode project
Build the app by going to File -> Build Settings, selecting iOS and clicking Build. Unity will build the selected scenes and produce an XCode project in the selected folder.
Depending on your versions of Unity and Xcode, you may be able to select Build and Run instead. In this instance, Unity will automatically open the built project in Xcode and run it on a connected device, if possible. This is not always the case, however, so it is usually safer to simply click Build and open the project yourself unless you know for a fact that your particular versions of Unity and Xcode are compatible.
Set up the Xcode project
In the Xcode project, there are two more things we need to set. First, select the project in the tree view on the left hand side and click the Build Settings tab. Scroll down to the Build Options section and find the entry marked Enable Bitcode. Set it to NO. Kudan’s framework is a fat binary and cannot be compiled in an app with bitcode enabled.
Next, check that you have a valid provisioning profile. With Xcode 8, profiles will automatically be taken care of for you, so all you should need to do is select a development team in the Signing section of the General tab. In older versions of Xcode, you’ll have to make sure that the correct profile has been selected, or that you are using a wildcard provisioning profile.
If everything has been set up, click the play button in the upper left corner of the screen and the app should build and run. If you have a device connected to your machine via USB, the app will run on that device once the build has finished.