All Products
Search
Document Center

Mobile Platform as a Service:Integrate into iOS

Last Updated:Nov 24, 2025

This topic describes how to preview a card on an iOS client.

Prerequisites

  • mPaaS has been activated and integrated.

  • The AntCubeTool of Ant Cube Card has been installed. For more details, please refer to: About AntCubeTool.

  • The integration process has been completed by referring to the Quick start.

Procedure

  1. Add the dependency for real device preview. Take Pod as an example.

    1. Add Pod module.

      mPaaS_pod "mPaaS_Cube" 
      mPaaS_pod "mPaaS_Cube_Dev"
      Important
      • mPaaS_Cube and mPaaS_Cube_Dev must be used in pairs.

      • Before releasing, be sure to delete mPaaS_Cube_Dev.

    2. Perform a pod update.

      pod mpaas update 10.2.3
    3. Execute the pod install.

      pod install

      image.png

    4. Add the dependency libraries required for code scanning and preview.

      #import <APCubePlayground/APCubePlayground.h>
      #import <AudioToolbox/AudioToolbox.h> 
      #import <MPCubeAdapter/MPCubeAdapter.h>
    5. Set up the preview page.

      Important
      • When using the preview function, you need to ensure that the engine has been initialized successfully.

      • If you use a custom extension module, you need to ensure that the custom module has been registered, otherwise it will be invalid.

      If you use the default preview page, you can directly call the following code:

      [[MPCubePreViewManager sharedInstance] setDefaultDebugPreview:true topOffset:0];

      If you define the preview page yourself, you need to actively register the listener and implement the CubeCardPreviewListener Protocol:

      [APCubePlayground registPreViewListener:id<CubeCardPreviewListener>];
      
      //  CubeCardPreviewListener
      - (void)onPreViewFinish:(BOOL)rst cubeCard:(CubeCard*)cubeCard {
          
      }
    6. Call the scan code preview method.

      - (void)scan {
          [APCubePlayground launch];
          [APCubePlayground scan];
      }
      Important

      The current App needs to have a NavigationController, otherwise no response will be received after the scan is called.

  2. Use the command line to start the local debugging service. In the path of the project, run the command to open the service. The instructions for enabling the service on macOS and Windows are as follows:

    • macOS: act prepare && act server

    • Windows: act prepare | act server

      1.png

      After the instruction is executed, a QR code will be generated at the terminal.

  3. Start the client and scan the code to establish a connection. The terminal will prompt that the device is connected.

    2.png

  4. Card preview.

    Create a new window in the terminal, open another window, use the cd command to switch to the project directory and execute act build to complete the compilation. Then call act preview to push the compiled content to the client.

    3.jpg

    • If the default preview page is set to be used, the client will automatically jump to display the preview card.

    • If you define your own preview interface, the CubeCardPreviewListener Protocol callback will be triggered. At this point, the business side can obtain the CubeCard instance and render it.