How to connect native Xsolla SDK for iOS to your project

You can use native Xsolla SDK for iOS to implement features, such as social login and returning to applications after purchase for mobile applications.

To connect the native SDK to a Cocos Creator project, follow these steps:

  1. Generate a project for Xcode.
  2. Connect the Xsolla SDK for iOS to the project.
  3. Set up the project in Xcode.

Generate project for Xcode

  1. In the Cocos Creator editor, go to Project > Build in the main menu. If the application wasn’t built for platforms before, a window for creating a new configuration for build will open. If the editor already has configurations to build, click New Build Task to create a new configuration.
  2. In the New Build Configuration window, make the following changes:

    1. In the Platform field, select iOS from the list of available build platforms.
    2. In the Developer Team section, specify your developer profile.

  1. Click Build.
  2. In the main menu, go to File > Project Settings.
  3. In the Build System field, specify New Build System.

As a result, a project for Xcode is generated in the <CocosProjectPath>/build/iOS/proj directory. Files that are used for all iOS builds, are generated in the <CocosProjectPath>/native/engine/ios directory.

Connect Xsolla SDK for iOS to project

Add connector scripts for the Xsolla SDK libraries to the source code. To do this:

  1. Copy files from the <CocosProjectPath>/extensions/xsolla-commerce-sdk/native/ios/Scripts folder to the <CocosProjectPath>/native/engine/ios folder.
  2. Open the <CocosProjectPath>/native/engine/ios/CMakeLists.txt file with any text editor and add the following lines to the PROJ_SOURCES list:

Full screen
Small screen

    Set up project in Xcode

    1. In Xcode, open your project from the <CocosProjectPath>/build/ios/proj directory.
    2. Connect the frameworks from the Xsolla SDK to the project. To do this:

      1. Go to project settings.
      2. Select the target with the name of your project.
      3. Go to the General > Embedded Content section and click on the + icon.
      4. In the window that appears, select Add Other > Add Files from the drop-down list.
      5. Select all the framework folders in the <CocosProjectPath>/extensions/xsolla-commerce-sdk/native/ios/Frameworks directory and click Open.
    Was this article helpful?
    Thank you!
    Is there anything we can improve? Message
    We’re sorry to hear that
    Please explain why this article wasn’t helpful to you. Message
    Thank you for your feedback!
    We’ll review your message and use it to help us improve your experience.
    Rate this page
    Rate this page
    Is there anything we can improve?

    Don’t want to answer

    Thank you for your feedback!
    Last updated: January 22, 2024

    Found a typo or other text error? Select the text and press Ctrl+Enter.

    Report a problem
    We always review our content. Your feedback helps us improve it.
    Provide an email so we can follow up
    Thank you for your feedback!