- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//...
KlevinAdSDKConfiguration.configuration.allowPersonalizedRecommendation = [KLNPersonalizedRecommendationMgr getPersonalizedRecommendationStatus];
[KlevinAdSDK.sharedInstance startWithCompletionHandler:^(NSError * _Nullable error) {
if (error) {
KLNDemoLog(@"初始化失败:%@", error.localizedDescription);
} else {
KLNDemoLog(@"初始化成功");
}
} withConfiguration:KlevinAdSDKConfiguration.configuration];
return YES;
}
static NSString *const kKLNPersonalizedRecommendationKey = @"kKLNPersonalizedRecommendationKey";
@implementation KLNPersonalizedRecommendationMgr
+ (BOOL)getPersonalizedRecommendationStatus {
if (![[NSUserDefaults standardUserDefaults] objectForKey:kKLNPersonalizedRecommendationKey]) {
return YES; //没有的话默认为YES
}
return [[NSUserDefaults standardUserDefaults] boolForKey:kKLNPersonalizedRecommendationKey];
}
+ (void)setPersonalizedRecommendationStatus:(BOOL)status {
[[NSUserDefaults standardUserDefaults] setBool:status forKey:kKLNPersonalizedRecommendationKey];
KlevinAdSDKConfiguration.configuration.allowPersonalizedRecommendation = status;
}