如何解决我无法使用我的代码加载Google AdMob gdpr同意书
我已按照Google的说明https://developers.google.com/admob/ios/eu-consent#objective-c进行了实施,并提出了以下代码: 我使用的是Xcode 11.5版,表单没有显示的代码没有错误。
#import "boogagoogleform.h"
#import <PersonalizedAdConsent/PersonalizedAdConsent.h>
@interface boogagoogleform ()
@end
@implementation boogagoogleform
- (void)viewDidLoad {
[super viewDidLoad];
// TODO: Replace with your app's privacy policy url.
NSURL *privacyURL = [NSURL URLWithString:@"https://www.your.com/privacyurl"];
PACConsentForm *form = [[PACConsentForm alloc] initWithApplicationPrivacyPolicyURL:privacyURL];
form.shouldOfferPersonalizedAds = YES;
form.shouldOfferNonPersonalizedAds = YES;
form.shouldOfferAdFree = FALSE;
[form loadWithCompletionHandler:^(NSError *_Nullable error) {
NSLog(@"Load complete. Error: %@",error);
if (error) {
// Handle error.
} else {
// Load successful.
}
}];
[form presentFromViewController:self
dismissCompletion:^(NSError *_Nullable error,BOOL userPrefersAdFree) {
if (error) {
// Handle error.
} else if (userPrefersAdFree) {
// The user prefers to use a paid version of the app.
} else {
// Check the user's consent choice.
PACConsentStatus status =
PACConsentInformation.sharedInstance.consentStatus;
}
}];
[PACConsentInformation.sharedInstance
requestConsentInfoUpdateForPublisherIdentifiers:@[ @"pub-012345678" ]
completionHandler:^(NSError *_Nullable error) {
if (error) {
// Consent info update failed.
} else {
// Consent info update succeeded. The shared PACConsentInformation
// instance has been updated.
}
}];
PACConsentInformation.sharedInstance.consentStatus = PACConsentStatusPersonalized;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。