Integrate real-device preview for iOS
You can preview Ant Cube cards on a real iOS device to verify rendering before release.
Prerequisites
-
mPaaS has been activated and integrated.
-
AntCubeTool is installed. For more information, see About AntCubeTool.
-
The integration process in Quick start is complete.
Procedure
-
Add the real-device preview dependency. The following example uses a pod.
-
Add the pod modules.
mPaaS_pod "mPaaS_Cube" mPaaS_pod "mPaaS_Cube_Dev"Important-
You must use mPaaS_Cube and mPaaS_Cube_Dev together.
-
Before you publish the app, make sure to delete mPaaS_Cube_Dev.
-
-
Update the pod.
pod mpaas update 10.2.3 -
Run
pod install.pod install
-
Add the dependency libraries required for the QR code scan preview.
#import <APCubePlayground/APCubePlayground.h> #import <AudioToolbox/AudioToolbox.h> #import <MPCubeAdapter/MPCubeAdapter.h> -
Set the preview page.
Important-
Before you use the preview feature, ensure that the engine is initialized.
-
A custom extension module is invalid unless it is registered.
-
If you use the default preview page, call the following code:
[[MPCubePreViewManager sharedInstance] setDefaultDebugPreview:true topOffset:0]; -
If you define a custom preview page, register the
listenerand implement theCubeCardPreviewListener Protocol:[APCubePlayground registPreViewListener:id<CubeCardPreviewListener>]; // CubeCardPreviewListener - (void)onPreViewFinish:(BOOL)rst cubeCard:(CubeCard*)cubeCard { }
-
-
Call the QR code scan preview method.
- (void)scan { [APCubePlayground launch]; [APCubePlayground scan]; }ImportantThe current app must have a
NavigationController. Otherwise, the app will not respond after you callscan.
-
-
Start the local debugging service from the command line. In the project directory, run the following command:
-
macOS:
act prepare && act server -
Windows:
act prepare | act serverAfter the command runs, a QR code is generated in the terminal.

-
-
Start the client and scan the QR code to connect. The terminal confirms that the device is connected.

-
Preview the card.
Open a new terminal window, navigate to the project folder with
cd, and runact buildto compile the project. Then runact previewto push the compiled content to the client.
-
If you use the default preview page, the client automatically redirects to display the preview card.
-
If you define a custom preview interface, the
CubeCardPreviewListener Protocolcallback is triggered. Your app can then retrieve theCubeCardinstance and render it.
-