The MCDP component provides promotion APIs and splash screen APIs for iOS integration.
Promotion APIs
Promotion interface class
This class is the unified entry point for promotion features. Call the APIs in this class to implement promotion-related features.
@interface CDPPromotionInterface : NSObject
@end
Start the component
API definition
+ (void)start;
Description
Starts the MCDP component, which initializes all promotion data and preloads resource images.
Example
[CDPPromotionInterface start];
Check the MCDP component version
API definition
+ (NSString *)sdkVersion;
Description
Returns the version number of the MCDP component.
Applicable versions: This API is available in version 3.0.0 and later.
Example
NSString cdpVersion = [CDPPromotionInterface sdkVersion];
Report ad sharing events
API definition
+ (NSString *)reportShareAdAction;
Description
Reports ad sharing events so that ad sharing data appears on the campaign performance page in the MCDP console. The reported data includes the number of ad shares and the number of unique devices that shared ads. The number of ad shares is the total number of times an ad on a campaign landing page was shared within a specific period. The number of unique devices is the total count of deduplicated devices that clicked the share button on a campaign landing page within a specific period. For more information about how ad sharing data is displayed, see View campaign performance.
Applicable versions: This API is available in version 3.0.0 and later.
Example
[CDPPromotionInterface reportShareAdAction];
Promotion properties
Promotion properties include the logon notification name, logoff notification name, and whether to use location information.
Property definition
@interface CDPPromotionInterface : NSObject
// User configuration items
@property (nonatomic, strong) NSString* loginNotificationName; // The name of the logon notification. The default value is empty.
@property (nonatomic, strong) NSString* logoutNotificationName; // The name of the logoff notification. The default value is empty.
@property (nonatomic, assign) BOOL useLbsInfo; // Specifies whether to use location information. The default value is NO.
@end
Property descriptions
|
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
loginNotificationName |
NSString |
No |
The name of the logon notification. The default value is empty. MCDP internally refreshes the promotion content for the corresponding user based on this notification. |
|
logoutNotificationName |
NSString |
No |
The name of the logoff notification. The default value is empty. MCDP internally clears cached promotion data based on this notification. |
|
useLbsInfo |
BOOL |
No |
Specifies whether CDP internally uses location information. The default value is NO, which means location information is not used. |
Example
[CDPPromotionInterface sharedInstance].loginNotificationName = @"xxxx";
Splash screen APIs
MCDP provides C language methods for splash screen logic:
-
Determining whether to show the splash screen
-
Opening the splash screen
-
Sending a notification to close the splash screen
Determine whether to show the splash screen
API definition
BOOL splashScreenExist(BOOL shouldShowSplashScreen);
Description
Determines whether to show the splash screen based on user-defined rules and internal MCDP rules.
Parameter description
|
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
shouldShowSplashScreen |
BOOL |
Yes |
Determines whether to show the splash screen based on user-defined rules. |
Example
BOOL shouldShowSplash = YES;
// Logic to determine if a splash screen ad is needed....
shouldShowSplash = splashScreenExist(shouldShowSplash);
Open the splash screen
API definition
UIWindow * APSplashScreenStart(void (^dismiss)(void));
Description
Opens the splash screen and displays the splash screen ad.
Parameter description
|
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
dismiss |
block |
Yes |
The callback block for when the splash screen closes. |
Return value description
|
Parameter |
Description |
|---|---|
|
UIWindow |
The created splash screen window. |
Example
UIWindow *splashWindow = APSplashScreenStart(^{
// Callback for when the splash screen closes
// do something ...
});
Notification to Close the Splash Screen
API definition
void APWillKillSplashScreen(void);
Description
After the framework finishes starting and loading, call this API to notify the framework that the splash screen is about to close. The splash screen may not close immediately after the notification is sent.
Example
APWillKillSplashScreen();