You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
We created an app in Unity using C# and decided to go with Google Admob to show our ads.
We have got all the ads to work successfully (woohoo!), now we just need to set up our EU consent but because we have no experience in Objective-C, and very little experience in X-Code, we're finding this quite difficult!
We're not using mediation, so we just want to use the Google Rendered Consent Form,
Hopefully we can get some help on this.
Do I need to create a new class in Xcode to set this PAC Consent form up, or can I just put it in an existing class file. (For example, we tried putting the code from the documentation https://developers.google.com/admob/ios/eu-consent in the PersonalizedAdConsent.h file in XCode, though we are unsure if this is the right thing to do.)
I'm started learning some Objective-C/XCode to try and get my head around how to implement it, and this is what I came up with if I were to create a new class...
// Show Consent Form
[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;
}
}];
[EDIT: FOR SOME REASON I CAN'T GET THE CODE PASTER THING TO FORMAT PROPERLY SO HERE IS AN IMAGE, ALSO THIS IS IN VSCODE BECAUSE IM JUST MESSING AROUND WITH LEARNING IT ON MY PC BEFORE GOING ONTO THE MAC AND TRYING IT]
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
We created an app in Unity using C# and decided to go with Google Admob to show our ads.
We have got all the ads to work successfully (woohoo!), now we just need to set up our EU consent but because we have no experience in Objective-C, and very little experience in X-Code, we're finding this quite difficult!
We're not using mediation, so we just want to use the Google Rendered Consent Form,
Hopefully we can get some help on this.
Do I need to create a new class in Xcode to set this PAC Consent form up, or can I just put it in an existing class file. (For example, we tried putting the code from the documentation https://developers.google.com/admob/ios/eu-consent in the PersonalizedAdConsent.h file in XCode, though we are unsure if this is the right thing to do.)
I'm started learning some Objective-C/XCode to try and get my head around how to implement it, and this is what I came up with if I were to create a new class...
'#import "ViewController.h"'
#import <PersonalizedAdConsent/PersonalizedAdConsent.h>
//I think this line is for testing purposes only :D
PACConsentInformation.sharedInstance.debugGeography = PACDebugGeographyEEA
@interface ViewController ()
@EnD
@implementation ViewController
(void)viewDidLoad {
[super viewDidLoad];
// Update Consent Status
[PACConsentInformation.sharedInstance
requestConsentInfoUpdateForPublisherIdentifiers:@[ @"pub-PUTOURSINHERE" ]
completionHandler:^(NSError *_Nullable error) {
if (error) {
// Consent info update failed.
} else {
// Consent info update succeeded. The shared PACConsentInformation
// instance has been updated.
}
}];
// Collect Consent
// 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 = NO;
// Load Consent Form
[form loadWithCompletionHandler:^(NSError *_Nullable error) {
NSLog(@"Load complete. Error: %@", error);
if (error) {
// Handle error.
} else {
// Load successful.
}
}];
}
@EnD
Any help would be greatly appreciated, thank you!
[EDIT: FOR SOME REASON I CAN'T GET THE CODE PASTER THING TO FORMAT PROPERLY SO HERE IS AN IMAGE, ALSO THIS IS IN VSCODE BECAUSE IM JUST MESSING AROUND WITH LEARNING IT ON MY PC BEFORE GOING ONTO THE MAC AND TRYING IT]
The text was updated successfully, but these errors were encountered: