Search...
Menu

Integration

Please check here to download the latest SDK.

  1. Select the MCSDK Version
  2. Select mediation platform
  3. Choose the Ad Network
  4. Click "Generate Integration Code" and refer to the integration configuration for details
  5. Add the CocoaPods Code to your podfile.
  6. Execute pod install --repo-update in terminal.

2. Initialization

2.1 Create MCInitConfig object

objc Copy
    // init SDK
    MCInitConfig *config = [[MCInitConfig alloc] init];
    config.appId = kMCSDKConfigInitAppId;   //TopOn AppID
    config.appKey = kMCSDKConfigInitAppKey;  // TopOn AppKey
//    config.defaultStrategyPath = [[NSBundle mainBundle] pathForResource:@"DefaultAppSettings" ofType:nil];  //Path for local default preset strategy file
    config.timeoutForUseDefaultStrategy = 0; //How long to wait for the first request of online strategy before using the local default preset strategy, default 0, no waiting
//    config.privacySettingsEnable = YES; //Whether to use the built-in privacy process of sdk
    [[MCAPI sharedInstance] setMediationUpdateDelegate:self]; //Set delegate

2.2 Perform initialization

objc Copy
[[MCAPI sharedInstance] initWithConfig:config delegate:self]; //Initialize multi-aggregation SDK with the config object from step one
objc Copy
- (void)didMediationInitFinished:(NSArray<NSNumber *> *)successMediationIdList failedError:(MCError *)failedError {
    // Initialization result
    NSLog(@"MC --- init: %@,  error: %@",successMediationIdList,failedError);
}

- (void)didMediationUpdated:(NSDictionary *)newAppSettings oldAppSettings:(NSDictionary *)oldAppSettings {
    NSLog(@"MC --- update new: %@, old: %@", newAppSettings, oldAppSettings);
}

2.4 Example code

objc Copy
- (void)initMCSDK {
    [[MCAPI sharedInstance] setLogEnabled:YES];
    
    //Custom rules
    [MCAPI sharedInstance].customData = @{
        kMCCustomDataUserIDKey:@"test_custom_user_id"
    };
    
    //Personalization
    [[MCAPI sharedInstance] setPersonalizedAdState:MCPersonalizedAdStateType];
    //gdpr
    [MCAPI sharedInstance].dataConsentSet = MCDataConsentSetNonpersonalized;
    //coppa
    [MCAPI sharedInstance].isAgeRestrictedUser = YES;
    //ccpa
    [MCAPI sharedInstance].doNotSell = YES;
    //Mute
    [MCAPI sharedInstance].mute = YES;
    // Set channel
    [MCAPI sharedInstance].channel = @"channel";
    // Set sub-channel
    [MCAPI sharedInstance].subChannel = @"subChannel";
    
    // init SDK
    MCInitConfig *config = [[MCInitConfig alloc] init];
    config.appId = kMCSDKConfigInitAppId;
    config.appKey = kMCSDKConfigInitAppKey;
//    config.defaultStrategyPath = [[NSBundle mainBundle] pathForResource:@"DefaultAppSettings" ofType:nil];
    config.timeoutForUseDefaultStrategy = 0;
//    config.privacySettingsEnable = YES;
    [[MCAPI sharedInstance] setMediationUpdateDelegate:self];
    [[MCAPI sharedInstance] initWithConfig:config delegate:self];
}

- (void)didMediationInitFinished:(NSArray<NSNumber *> *)successMediationIdList failedError:(MCError *)failedError {
    // Initialization result
    NSLog(@"MC --- init: %@,  error: %@",successMediationIdList,failedError);
}

- (void)didMediationUpdated:(NSDictionary *)newAppSettings oldAppSettings:(NSDictionary *)oldAppSettings {
    NSLog(@"MC --- update new: %@, old: %@", newAppSettings, oldAppSettings);
}

2.5 MCDataConsentSet Enumeration

MCDataConsentSet Enum Value Description
MCDataConsentSetUnknown 0 Default to prohibit data consent if not set
MCDataConsentSetPersonalized 1 Consent
MCDataConsentSetNonpersonalized 2 Consent

2.6 MCPersonalizedAdState Enumeration

MCPersonalizedAdState Enum Value Description
MCPersonalizedAdStateType 1 Allow personalization
MCNonpersonalizedAdStateType 2 Prohibit personalization

3. Preset Strategy

It is recommended to configure a preset strategy to improve the ad loading performance on the first app launch.

Previous
iOS
Next
AD Formats
Last modified: 2025-09-08Powered by