All Products
Search
Document Center

Mobile Platform as a Service:Quick start

Última atualização: Jun 16, 2026

Ant Cube Card (Cube Card) originated from the demand for dynamic native pages. With the emergence of Mini Programs, Cube Cards were integrated into the Alipay Mini Program technology stack as a lightweight alternative to web-based Mini Programs.

Cube Card supports three integration methods: integrate based on mPaaS framework, integrate based on existing projects and using mPaaS plugins, and integrate based on existing projects and using CocoaPods. This guide walks you through integration and usage.

Prerequisites

Connection steps

  1. Select a baseline.

    1. Add the 10.2.3 main baseline.

    2. Add the card component.

  2. Initialize the card.

  3. Build a card project.

    1. Initialize the project.

    2. Build the project.

  4. Publish a card.

    1. Go to the card backend.

    2. Create a card.

    3. Add card resources.

    4. Publish the card.

  5. Render the card.

  1. Select baseline.

    Cube Card is supported in baseline 10.2.3. Select the appropriate component addition method based on your integration method.

    • Use mPaaS Xcode Extension

      Applicable to: Integrate based on mPaaS framework or Integrate by using mPaaS plugin based on existing projects.

      1. Click the Xcode menu item EditormPaaS Edit Project Upgrade Baseline to switch the project to the 10.2.3 baseline.

        Note

        If the "Upgrade Baseline" option is not clickable, make sure the project configuration has been imported. Refer to the Prerequisites section to open the project editing page.

      2. After upgrading the baseline, click Edit Module > Modify Module, select the Cube Card, save, and then click Start Editing to complete the addition.

    • Use cocoapods-mPaaS Plugin

      Applicable to: Integrate by using CocoaPods based on the existing project.

      1. Perform the following operations in the Podfile.

        1. Change mPaaS_baseline to 10.2.3.

        2. Use mPaaS_pod "mPaaS_Cube" to add the Cube Card component dependency.

      2. Run pod install to complete the integration.

  2. Initialize the card.

    1. Compile the Xcode project. If the header file cannot be found, set Allow Non-modular Includes In Framework Modules to Yes, as shown in the following figure.

      image

    2. Add system dependencies.

      image

    3. Import the libraries required for Cube Card.

      #import <CubeCrystal/CubeEngine.h>
      #import <AntCube/CubeService.h>
    4. Use a singleton to initialize the card engine.

      - (void)initEngie{
          static dispatch_once_t onceToken;
          NSString *mockBundlePath = [NSString stringWithFormat:@"%@/%@/crystal", [[NSBundle mainBundle] resourcePath], @"MPCubeDemo.bundle"];
          dispatch_once(&onceToken, ^{
              CubeEngineConfig* config = [[CubeEngineConfig alloc] init];
              [config setBundlePath:mockBundlePath];
              [[CubeService sharedInstance] initWithConfig:config]; 
          });
      }
  3. Build a card project.

    1. Initialize a project. Run the act init command in the terminal.

      • Select Application Type as Cube and select Template Card (VUE format).

      • Enter an application name. Use a combination of English letters, numbers, and underscores.

      • Select "Create an additional project source code folder" to create a subfolder named after the application. If you select "Do not", the project is initialized in the current directory.

    2. Build the project. Run cd to navigate to the card project directory, then run act build. The build output is stored in the /dist/ folder.

      image

  4. Release the card.

    1. Go to the Ant Cube Card platform.

      image

    2. Click Create Card.

      1769064849937_79D6F38B-E7A1-4556-8271-C7D0E996E619

      Use a combination of English letters, numbers, and underscores for the card ID. The client relies on the card ID to render the card. The card name can be any value.

    3. Add card resources.

      • Use a 4-digit version number.

      • Select the main.zip that you just compiled.

      • The client range specifies which client versions can pull the card. To cover all client versions, enter 0.0.0.0 in the minimum version field.

      1769064886314_4503287A-684C-46da-8B03-F68481C6F725

    4. Release the card.

      1. Click Create Release.

        1769065000293_B0B254A1-468C-419d-B7EA-5E66CED8826C

      2. Select Official Release.

        1769065047912_4C937D5B-3FDE-4d0b-AA71-10C6E9E467CF

      After the card is released, clients can pull and display it.

  5. Render the card.

    1. Copy the card ID and card version number from the webpage.

      //Create card object.
      CubeCardConfig *cardConfig = [[CubeCardConfig alloc] init];
      //Configure the card version (required), copied from the console.
      [cardConfig setVersion:@"1.0.0.0"];
      //Configure card ID (required), copy from console.
      [cardConfig setTemplteId:@"20211118"];
      //Preset card width.
      [cardConfig setWidth:[UIScreen mainScreen].bounds.size.width];
      //Preset card height.
      [cardConfig setHeight:350];
      //Set the card data (required) parameter to business JSON data.
      [cardConfig setData:@{}];
      //Load the card.
      [[[CubeService sharedInstance] getEngine] createCard:cardConfig callback:self];
      
    2. The card retrieves the value for the key "iosImage", as shown in the following code:

       [self.cardConfig setData:@{@"iosImage":@"https://img.zcool.cn/community/013edb5c7b5b1ca801213f269fc887.jpg@1280w_1l_2o_100sh.jpg"}];
    3. The delegate method for card creation must conform to the CCardCallback protocol and implement the onLoaded:cardType:config:erroCode method.

      @interface ViewController () <CCardCallback>
      @end
      - (void)onLoaded:(CubeCard *)card cardType:(CCardType)cardType config:(CubeCardConfig *)config erroCode:(CubeCardResultCode)erroCode {
          //Card creation failed
          if (!card) {
              NSLog(@"load card fail %@ style %d error %d", [config templteId], cardType, erroCode);
              return;
          }
          
          //Creation successful
          NSLog(@"load card success %@ style %d error %d", [config templteId], cardType, erroCode);
          
          dispatch_async(dispatch_get_main_queue(), ^{
              //Main thread UI operations: Rendering cards
      		CubeView *view = [[[CubeService sharedInstance] getEngine] createView];
              CGSize size = [card getSize];
              [view setFrame:CGRectMake(0, 20, size.width, size.height) ];
              [self.view addSubview:view];
              
              [card renderView:view];
          });
      }
    4. Build & Run.

      • If compilation and execution are successful, the Xcode command line may report an RPC request exception. For details, please refer to RPC request exception.

  6. Effect preview.

Demo Reference

For a demo of this integration method, download MPCubeDemo_Pod.zip.