CoronaCards — iOS

Xcode Project Setup

This guide outlines how to configure CoronaCards for usage with an existing iOS-based Xcode project.

Note

If you're creating a new CoronaCards-based project, you can use CoronaCards Xcode project templates. Simply follow the instructions in the README.

Important

In order for any CoronaCards project to work, you must put a valid license.ccdata file near main.lua, otherwise you'll get a black screen and corresponding error message in the console.

  1. First, link your app to the C++ library. The easiest way is to rename your main.m file to main.mm within the Supporting Files branch of the Xcode project tree.

  2. Include the CoronaCards framework in your project's frameworks by dragging /Users/Shared/CoronaLabs/ios/CoronaCards.framework to the Frameworks group in your Xcode project.

    In addition, CoronaCards depends on several other frameworks. These can be added from the General properties view. In this viewport, scroll down to Linked Frameworks and Libraries, then press the + button to link the frameworks listed below. Note that CoronaCards.framework is already on the list because you copied it to your Frameworks group.

Framework  
AdSupport.framework (may be skipped if your app doesn't use ads)
AudioToolbox.framework  
AVFoundation.framework  
CFNetwork.framework  
CoreGraphics.framework  
CoreLocation.framework  
CoreMedia.framework  
CoreMotion.framework  
CoreVideo.framework  
Foundation.framework  
GameController.framework (with status optional)
GLKit.framework  
ImageIO.framework  
MediaPlayer.framework  
MobileCoreServices.framework  
OpenAL.framework  
OpenGLES.framework  
QuartzCore.framework  
Security.framework  
SystemConfiguration.framework  
UIKit.framework  

Also, link the following libraries in the same way:

Library  
libsqlite3  
libobjc  
libstdc++.6  
  1. Click the Build Settings tab to configure build settings. Ensure that the All sub-tab is selected and then set the following:
Section Setting Value
Search Paths Framework Search Paths /Users/Shared/CoronaLabs/ios/
Build Options Enable Bitcode No
Deployment iOS Deployment Target iOS 8.0 or higher
Linking Other Linker Flags -ObjC
  1. Lua code and assets for CoronaCards must be copied to the app bundle before deployment, so you must configure the run script. The best method is to create a Corona folder in your project via the Finder and place your assets within it. Then, configure a Run Script Build Phase to copy the assets upon building the project:
  • Click on the Build Phases tab.
  • From the Xcode main menu, select EditorAdd Build PhaseAdd Run Script Build Phase.
  • In the viewport, notice the Run Script entry. Expand this tree if necessary and, in the code editor box just below the input field containing /bin/sh, enter these two lines of code:
echo "Copying Corona assets"
ditto -V $PROJECT_DIR/Corona "$TARGET_BUILD_DIR"/"$EXECUTABLE_FOLDER_PATH"