Please check here to download the latest SDK.
- Select the MCSDK Version
- Select mediation platform
- Choose the Ad Network
- Click "Generate Integration Code" and refer to the integration configuration for details
- Add the CocoaPods Code to your
podfile
.- Execute
pod install --repo-update
in terminal.
// 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
[[MCAPI sharedInstance] initWithConfig:config delegate:self]; //Initialize multi-aggregation SDK with the config object from step one
- (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);
}
- (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);
}
MCDataConsentSet | Enum Value | Description |
---|---|---|
MCDataConsentSetUnknown | 0 | Default to prohibit data consent if not set |
MCDataConsentSetPersonalized | 1 | Consent |
MCDataConsentSetNonpersonalized | 2 | Consent |
MCPersonalizedAdState | Enum Value | Description |
---|---|---|
MCPersonalizedAdStateType | 1 | Allow personalization |
MCNonpersonalizedAdStateType | 2 | Prohibit personalization |
It is recommended to configure a preset strategy to improve the ad loading performance on the first app launch.