All Products
Document Center


Last Updated: May 06, 2022

You can refer to the related code snippets to learn the usage of the framework and MCDP.

For the download address and usage method of the code example, refer to Obtain code sample. For API description, refer to API description.

Start MCDP

After you start the App, you can call the start method to initialize and start MCDP.

The method is as follows:

[CDPPromotionInterface start];

We recommend that you add the code to the - (void)application:(UIApplication *)application beforeDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions; method.

Configure MCDP SDK

You can configure the MCDP SDK according to actual needs. For example, you can set the notification upon user's logon and logout.

The method is as follows:

// Configure the notification name upon a user's logon. This parameter has no default value.
[CDPPromotionInterface sharedInstance].loginNotificationName = @"xxxx";
// Configure the notification name a user's logout. This parameter has no default value.
[CDPPromotionInterface sharedInstance].logoutNotificationName = @"xxxx";
// Configure whether to use location information.
[CDPPromotionInterface sharedInstance].useLbsInfo = YES;

Register container plugin

To use relevant JSAPIs on the HTML5 pages, you need to register the container plugin of MCDP.

Content delivery to HTML5 pages depends on HTML5 container (Nebula). HTML5 container initialization is required before you register the contaier plugin. Just add the following code to -(void)application:(UIApplication *)application beforeDidFinishLaunchingWithOptions:(NSDictionary*)launchOptions in DTFrameworkInterface to implement the container initialization. See Initialize HTML5 container to learn more.

 // Initialize container
 [MPNebulaAdapterInterface initNebula];

Refer to Custom plug-in and register the container plugin used by MCDP as shown in the following figure.

Register container plugin

Report data sharing

This function allows you to report data sharing on the advertisement page. When a user completes sharing, the sharing action and related data is reported by calling the sharing reporting API. After this function is integrated, you can observe the corresponding data indicators on the dashboard of the console.

The procedure is as follows:

  1. Listen to the notification of tapping to share event.

     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(shareAd:) name:MPCDPDidShareAdNotification object:nil];
  2. Perform sharing in notification processing, and call the sharing reporting API after sharing is performed.

     - (void)shareAd:(NSNotification *)notification {
         NSString *adUrl = notification.object;
         // Initiate sharing
         // ...
         // Report advertisement sharing
         [[CDPPromotionInterface sharedInstance] reportShareAdAction];