Table of Contents

Enable EasyAR in iOS apps

This chapter describes how to configure an EasyAR project for iOS in Xcode without using 3D engines like Unity.

Preparations

Before starting, you need to prepare:

Enable EasyAR using Objective-C

  1. Add Frameworks

    Add easyar.xcframework under Frameworks, Libraries, and Embedded Content.

    addxframework1

  2. Disable Bitcode

    EasyAR does not use bitcode nor provide bitcode compatibility. Disable bitcode in the configuration.

    disablebitcode2

  3. Initialize EasyAR

    Use the initialize: method of easyar_Engine to initialize EasyAR. Add the initialization code as follows:

    [easyar_Engine initialize:key];
    
  4. Privacy configuration

    Since AR requires camera access, add Privacy - Camera Usage Description to the privacy configuration.

    campermission

    If screen recording is needed, add Privacy - Microphone Usage Description to the privacy configuration.

    microphonepermission

Enable EasyAR via Swift API

EasyAR Sense Swift API is provided in source code form to ensure optimal compatibility (Apple provides ABI compatibility starting from Swift 5).

To use EasyAR Sense Swift API, first create a framework project, then embed the framework target into your project.

Create EasyARSwift framework project

  1. Create a new project of type Cocoa Touch Framework and name it EasyARSwift

    You can choose to embed the EasyARSwift project within your app project or create a standalone project.

    embedprj

  2. Import EasyAR Swift code into the EasyARSwift project

    embedswiftcode2

    The automatically generated EasyARSwift.h file by Xcode is unused and can be safely deleted.

  3. Configure Objective-C Bridging Header in build settings

    bridgeheader

    Note

    This option won't appear in Xcode settings before importing swift files, so be sure to import Swift code first before modifying the configuration.

  4. Import easyar.xcframework into the EasyARSwift project

    addxframework3

  5. Disable Bitcode

    EasyAR does not use bitcode nor provide bitcode compatibility. Ensure bitcode is disabled in the configuration. disablebitcode

  6. Deployment Target

    Modify the deployment target according to your app project. Ensure the deployment target of the EasyARSwift project is less than or equal to that of the app project. setdeploytarget

Embed and use EasyARSwift framework

  1. Embed the EasyARSwift framework in your project

    embedswiftfw embedswiftfw2

  2. import EasyARSwift in Swift source files

    importeasyswift

Refer to the code in the HelloARSwift sample or the API Reference for implementation.