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
Add the dependency for real device preview. Take Pod as an example.
Add Pod module.
mPaaS_pod "mPaaS_Cube" mPaaS_pod "mPaaS_Cube_Dev"ImportantmPaaS_Cube and mPaaS_Cube_Dev must be used in pairs.
Before releasing, be sure to delete mPaaS_Cube_Dev.
Perform a pod update.
pod mpaas update 10.2.3Execute the
pod install.pod install
Add the dependency libraries required for code scanning and preview.
#import <APCubePlayground/APCubePlayground.h> #import <AudioToolbox/AudioToolbox.h> #import <MPCubeAdapter/MPCubeAdapter.h>Set up the preview page.
ImportantWhen 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
listenerand implement theCubeCardPreviewListener Protocol:[APCubePlayground registPreViewListener:id<CubeCardPreviewListener>]; // CubeCardPreviewListener - (void)onPreViewFinish:(BOOL)rst cubeCard:(CubeCard*)cubeCard { }Call the scan code preview method.
- (void)scan { [APCubePlayground launch]; [APCubePlayground scan]; }ImportantThe current App needs to have a
NavigationController, otherwise no response will be received after thescanis called.
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 serverWindows:
act prepare | act server
After the instruction is executed, a QR code will be generated at the terminal.
Start the client and scan the code to establish a connection. The terminal will prompt that the device is connected.

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 buildto complete the compilation. Then callact previewto push the compiled content to the client.
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 Protocolcallback will be triggered. At this point, the business side can obtain theCubeCardinstance and render it.