Coder Social home page Coder Social logo

googleads-consent-sdk-ios's Introduction

Google Mobile Ads Consent SDK

This SDK is no longer being maintained. We recommend using the User Messaging Platform SDK instead.

Under the Google EU User Consent Policy, you must make certain disclosures to your users in the European Economic Area (EEA) and obtain their consent to use cookies or other local storage, where legally required, and to use personal data (such as AdID) to serve ads. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR). To support publishers in meeting their duties under this policy, Google offers this Consent SDK.

Documentation

For additional documentation on the Google Mobile Ads Consent SDK, refer to the Consent SDK developer docs.

License

Apache 2.0 License

googleads-consent-sdk-ios's People

Contributors

ericleich avatar jweisbaum avatar rampara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

googleads-consent-sdk-ios's Issues

Error: consent form can be used with custom provider selection only.

When I try and present the PACConsentForm I get called back with an error:

Error: consent form can be used with custom provider selection only.

This seems to be coming from this code in consentform.html:

    function validateRawResponse(rawResponse) {
      var adNetworks = rawResponse['ad_network_ids'] || [];
      if (!adNetworks) {
        throw Error('Error: invalid ad networks.');
      }

      // All ad networks must have publisher_consent_type `2`.
      for (var i = 0; i < adNetworks.length; i++) {
        var adNetwork = adNetworks[i];
        var publisherConsentType = adNetwork['publisher_consent_type'] || 0;
        if (publisherConsentType != 2) {
          throw Error('Error: consent form can be used with custom provider selection only.');
        }
      }
    }

Debugging a little I tracked down code in PACView.m which is calling the Javascript in the web view:

- (void)updateWebViewInformation {
  dispatch_async(dispatch_get_main_queue(), ^{
    NSMutableDictionary<PACFormKey, id> *mutableFormInformation =
        [self->_formInformation mutableCopy];
    mutableFormInformation[PACFormKeyAppName] = PACShortAppName();
    mutableFormInformation[PACFormKeyAppIcon] = PACIconDataURIString();

    NSString *infoString = PACJSONStringForDictionary(mutableFormInformation);
    NSString *command = PACCreateJavaScriptCommandString(@"setUpConsentDialog", @{
      @"info" : infoString
    });
    [self->_webView stringByEvaluatingJavaScriptFromString:command];
  });
}

The mutableFormInformation contains a lot of JSON. Xcode's debugger output isn't quite valid JSON (lots of things are escaped with backslashes), but I was able to see this using an online JSON formatter:

json

The ad_network_ids array has a single element. My AdMob ad_network_id is obscured in this screenshot. The publisher_consent_type is 1, causing the validateRawResponse to throw the error because "All ad networks must have publisher_consent_type 2"

"Unable to convert data to string around character" error while requesting consent info

I was trying to detect EEA user with this SDK, but found strange behavior. When user is not EEA, SDK works well both simulator and device. When user is EEA, it works correctly only on simulator. Trying to run at the device (tested on both iOS 10.3.3 and iOS 11.3 versions) and it fails

Here is my source

NSString * publisherId = @"pub-0123456789012345";
[PACConsentInformation.sharedInstance requestConsentInfoUpdateForPublisherIdentifiers:@[publisherId]
                                                                    completionHandler:^(NSError * _Nullable error) {
                                                                        if (error) {
                                                                            NSLog(@"Detecting EEA member error: %@", error);
                                                                        }
                                                                        BOOL isEEA = PACConsentInformation.sharedInstance.requestLocationInEEAOrUnknown;
                                                                        NSLog(@"Is%@EEA member", isEEA ? @" " : @" not ");
                                                                    }];

And it produces next log:

2018-05-24 16:44:31.471684+0300 GDPRConsentSample[1033:674075] Detecting EEA member error: Error Domain=NSCocoaErrorDomain Code=3840 "Unable to convert data to string around character 19596." UserInfo={NSDebugDescription=Unable to convert data to string around character 19596.}
2018-05-24 16:44:31.471994+0300 GDPRConsentSample[1033:674075] Is not EEA member

I found out that error occurs during response parsing:

// From file PACPersonalizedAdConsent.m:328
NSDictionary<NSString *, id> *info = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];

Source was taken from cocoapods, version 1.0.0

requires_arc in podspec set to true

Hello I just seen the pod spec for this pod and it says requires_arc is set to true , but I do not have automatic reference counting turned on in my xcode project so how is is still building and working ?

Pinch zoom in and out is working over consent view in version 1.0.5

Unnecessary pinch-zoom in and out is working over consent view in the latest version 1.0.5, this issue is not present in 1.0.4.

Version Info :
Consent SDK-ios : 1.0.5
Device : iPhone XR
iOS : 13.3

For better understanding added screenshot below :

Pinch Zoom In:

IMG_4032

Pinch Zoom Out:

IMG_4031

Response error. Publisher identifiers not found "ca-app-" Appended

I have an empty view controller project in iOS/Swift, after viewDidLoad() I have the following but get the error:
Error Domain=Consent Code=1 "Response error. Publisher identifiers not found: ca-app-pub-MYID"

Obs. I have my own ID and admobID inserted. Can't seem to find why/where 'ca-pub-' is prepended? And if this is whats causing the error???

        PACConsentInformation.sharedInstance.consentStatus = PACConsentStatus.unknown
        PACConsentInformation.sharedInstance.requestConsentInfoUpdate(forPublisherIdentifiers: ["pub-MYID"]){
        
        (_ error: Error?) -> Void in
        if let error = error {
            // Consent info update failed.
            print(error)
        } else {
            // Consent info update succeeded. The shared PACConsentInformation instance has been updated.
            if PACConsentInformation.sharedInstance.consentStatus == PACConsentStatus.unknown {
                
                guard let privacyUrl = URL(string: "MYURL"),
                    let form = PACConsentForm(applicationPrivacyPolicyURL: privacyUrl) else {
                        print("incorrect privacy URL.")
                        return
                }
                form.shouldOfferPersonalizedAds = true
                form.shouldOfferNonPersonalizedAds = true
                form.shouldOfferAdFree = true
                
                form.load {(_ error: Error?) -> Void in
                    print("Load complete.")
                    if let error = error {
                        // Handle error.
                        print("Error loading form: \(error.localizedDescription)")
                    } else {
                        
                        form.present(from: self) { (error, userPrefersAdFree) in
                            
                            if error != nil {
                                // Handle error.
                            } else if userPrefersAdFree {
                                // User prefers to use a paid version of the app.
                                
                                
                                //buy the pro Version
                            }
                        }
                    }
                }
            }
        }
    }

Error when presenting consent-form: "invalid data. JSON Parse error: Unexpected EOF"

A very basic example fails already:

Error Domain=Consent Code=1 "Error: invalid data. JSON Parse error: Unexpected EOF" UserInfo={NSLocalizedDescription=Error: invalid data. JSON Parse error: Unexpected EOF}

  NSURL *privacyURL = [NSURL URLwithString:@"https://example.com/privacy"];
  
  PACConsentForm *form = [[PACConsentForm alloc] initWithApplicationPrivacyPolicyURL:privacyURL];
  form.shouldOfferPersonalizedAds = YES;
  form.shouldOfferNonPersonalizedAds = YES;
  form.shouldOfferAdFree = NO;
  
  [form loadWithCompletionHandler:^(NSError * _Nullable error) {
    if (error != nil) {
      // Handle error
      return;
    }

    [form presentFromViewController:[[[TiApp app] controller] topPresentedController] dismissCompletion:^(NSError * _Nullable error, BOOL userPrefersAdFree) {
        // Handle callback
    }];
  }];

CocoaPods specs missing

The docs state CocoaPods availability, but the .podspec does not seem to be published so far, so it cannot used in these environments.

EU Consent Form iOS Setup Help

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.

      // 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;
      }
      }];        
    

    }
    }];

}

@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]

GitHoob

Consent timestamp

if it is also law for the date and time consent was given why wasn't this added to this library ?

NullPointerException in production

I get a few NullPointerException crash report in production.

Samsung Galaxy S8 (dreamlte), 4096MB RAM, Android 8.0
Report 1 of 1
java.lang.NullPointerException: 
 
  at android.app.Dialog.<init> (Dialog.java:209)
 
  at android.app.Dialog.<init> (Dialog.java:194)
 
  at com.google.ads.consent.ConsentForm.<init> (ConsentForm.java:77)
 
  at com.google.ads.consent.ConsentForm.<init> (ConsentForm.java:46)
 
  at com.google.ads.consent.ConsentForm$Builder.build (ConsentForm.java:210)
 
  at org.yccheok.jstock.gui.WatchlistFragment.showConsentForm (WatchlistFragment.java:1997)

Any idea why such happen. My code to show consent form is as follow. I'm using

implementation 'com.google.android.ads.consent:consent-library:1.0.4'
    private void showConsentForm() {
        if (this.consentFormHolder != null) {
            return;
        }

        URL privacyUrl = null;
        try {
            privacyUrl = new URL(org.yccheok.jstock.network.Utils.getURL(org.yccheok.jstock.network.Utils.Type.PRIVACY_POLICY));
        } catch (MalformedURLException e) {
            Log.e(TAG, "", e);
        }

        this.consentFormHolder = new ConsentFormHolder();

        consentFormHolder.consentForm = new ConsentForm.Builder(getContext(), privacyUrl)
                .withListener(new ConsentFormListener() {
                    @Override
                    public void onConsentFormLoaded() {
                        // Consent form loaded successfully.
                        consentFormHolder.consentForm.show();
                    }

                    @Override
                    public void onConsentFormOpened() {
                        // Consent form was displayed.
                    }

                    @Override
                    public void onConsentFormClosed(
                            ConsentStatus consentStatus, Boolean userPrefersAdFree) {
                        consentFormHolder = null;

                        if (consentStatus == ConsentStatus.PERSONALIZED) {
                            ConsentInformation.getInstance(getContext())
                                    .setConsentStatus(consentStatus);

                            displayAdMob(false);

                            org.yccheok.jstock.gui.Utils.trackEvent(TAG, "showConsentForm", "personalized");
                        } else if (consentStatus == ConsentStatus.NON_PERSONALIZED) {
                            ConsentInformation.getInstance(getContext())
                                    .setConsentStatus(consentStatus);

                            displayAdMob(true);

                            org.yccheok.jstock.gui.Utils.trackEvent(TAG, "showConsentForm", "non_personalized");
                        } else if (userPrefersAdFree) {
                            ((JStockFragmentActivity)getActivity()).shop();

                            org.yccheok.jstock.gui.Utils.trackEvent(TAG, "showConsentForm", "shop");
                        } else {
                            displayAdMob(false);

                            org.yccheok.jstock.gui.Utils.trackEvent(TAG, "showConsentForm", "unknown");
                        }

                    }

                    @Override
                    public void onConsentFormError(String errorDescription) {
                        consentFormHolder = null;
                        displayAdMob(false);
                    }
                })
                .withPersonalizedAdsOption()
                .withNonPersonalizedAdsOption()
                .withAdFreeOption()
                .build();           <--- Line 1997

        consentFormHolder.consentForm.load();
    }

Compile Warning on Swift4

Environment:
XCode 9.2
Swift 4.0

After installing through cocoapods then build it. It prompts compile warning.

Nullability Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) PACView.h

In file included from /ProjectPath/Pods/PersonalizedAdConsent/PersonalizedAdConsent/PersonalizedAdConsent/PACConsentForm.m:21:

EU Consent Form Loads Without Internet Connection

I am implementing EU Consent in two iOS apps.
As required I am putting an update consent button in the settings of my apps in case the user wants to change their consent.
The consent form loads if there is no internet connection and the dialog box responds to clicking the buttons with no errors.
If the Internet connection has dropped out the user will believe that consent has been updated when it hasn't.

Am I missing something. There doesn't seem to be a callback from AdMob to confirm change of status or report error.

NoSuchMethodError at ConsentInformation.Java

Consent SDK crashes due to NoSuchMethodError at ConsentInformation Java class. Below is the stack track of the crash.

Process: com.miragestack.theapplock, PID: 13723
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NoSuchMethodError: No virtual method a(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object; in class Lcom/google/gson/e; or its super classes (declaration of 'com.google.gson.e' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
at com.google.ads.consent.ConsentInformation.a(ConsentInformation.java:386)
at com.google.ads.consent.ConsentInformation.a(ConsentInformation.java:47)
at com.google.ads.consent.ConsentInformation$ConsentInfoUpdateTask.a(ConsentInformation.java:242)
at com.google.ads.consent.ConsentInformation$ConsentInfoUpdateTask.a(ConsentInformation.java:272)
at com.google.ads.consent.ConsentInformation$ConsentInfoUpdateTask.doInBackground(ConsentInformation.java:189)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 4 more

EXC_BAD_ACCESS loadCompletedWithError

I get EXC_BAD_ACCESS in PACView.m at line pointed below. The block completion handler for requestConsentInfoUpdateForPublisherIdentifiers is working fine, just the form completion handler. Im curious if this has something to do with my project not being ARC.

Zombie setting didn't show it as collected memory, and printing it in the debugger also worked.
Any ideas?

/// Handles load completion.

  • (void)loadCompletedWithError:(nullable NSError *)error {
    dispatch_async(dispatch_get_main_queue(), ^{
    PAC_MUST_BE_MAIN_THREAD();
    if (self->_loadCompletionHandler) {
    self->_loadCompletionHandler(error); <======= ERROR
    }
    self->_loadCompletionHandler = nil;
    });
    }

screen shot 2018-05-24 at 7 04 08 am

screen shot 2018-05-24 at 7 05 44 am

Missing localization

Some keys are missing localization, please wrap them properly to allow full internationalization.

Localisations in EU Languages for Consent web view standard text.

[When we show the consent form in English language to a non English Speaker, then they will not understand the language and end up giving us bad ratings. If you can share the strings for your standard form (attached here) that will help us (and many others) to provide a good user experience while taking user consent.]
ios_eu_consent_form

Xcode 10.1 and pod sport

Hi,

I'm using Xcode 10.1, and added 'PersonalizedAdConsent' to my Podfile.

I have my platform set to 12.1, since it'll be required as of March 2019.

I'm getting two warnings and one error:

Warnings:

The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.1. (in target 'PersonalizedAdConsent')

The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.1. (in target 'PersonalizedAdConsent-PersonalizedAdConsent')

file not found error when I try and import the include file:

#import <PersonalizedAdConsent/PersonalizedAdConsent.h>

Now, eventually, Xcode gets around to giving me a warning to "update to recommended settings for the Pods.xcodeproj, saying

Target 'PersonalizedAdConsent' - Update iOS Deployment Target
An iOS Deployment Target earlier than 8.0 is not supported by this version of Xcode. This will update the value for Target 'PersonalizedAdConsent' to '8.0'

and

Target 'PersonalizedAdConsent-PersonalizedAdConsent' - Update iOS Deployment Target
An iOS Deployment Target earlier than 8.0 is not supported by this version of Xcode. This will update the value for Target 'PersonalizedAdConsent-PersonalizedAdConsent' to '8.0'

if I click "Perform Changes", clean the build folder, and then try to recompile, the warnings go away, but it still can't find the file to import.

What to do first: configureAds or requestConsent from user?

Hello colleagues,

what do you think, is it Ok to initialise Google Ads before requesting the ads consent from the user?
Or by calling the [GADMobileAds configureWithApplicationID:@"AppId"] will be already some user personalised information collected and send to Google?

Thanks!

Does the new UMP sdk replace this sdk?

We are using this consent sdk in our iOS right now and I am a bit confused about the announcment of the UMP sdk.
Does it replace this sdk here? Or may I continue to use just this sdk without any changes?

Many documentations only explain the UMP sdk in connection with iOS 14.... do we have to use both sdks parallely, this sdk for ios 12 and 13, and the UMP sdk for iOS 14?

Would be great if someone could help me 😀

Default branch is now `main`

As part of Google’s ongoing efforts to foster inclusive language, we’ve changed the default branch of this project to main. We encourage contributors to do the same for their forks and local development environments in order to minimize issues when creating pull requests.

UIWebView, deprecated API used

People has started receiving this warning when submitting apps that have references to UIWebView.

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs.

Changing .html file does not update the text on consent form

I use the consent SDK with cocoapods and change the consentform.html file in the resources folder and when I run it none of the texts change on my form, even if i delete the file the consent form still loads, so is there like a hidden consentform somewhere that Im not finding ?

Crashing immediately because of the nil value.

After consent form constructed and trying to load, crashing immediately at line 188 of PACView.m because of nil value of the bundleURL.

/// Loads the consent form HTML into the web view.

  • (void)loadWebView {
    NSURL *bundleURL =
    [[NSBundle mainBundle] URLForResource:@"PersonalizedAdConsent" withExtension:@"bundle"];
    NSBundle *bundle = [NSBundle bundleWithURL:bundleURL];
    NSURL *URL = [bundle URLForResource:@"consentform" withExtension:@"html"];
    NSURLRequest *URLRequest = [[NSURLRequest alloc] initWithURL:URL];
    [_webView loadRequest:URLRequest];
    }

Xcode 9.2 won't open the PersonalizedAdConsent.xcodeproj - it's too new

I'm using Xcode 9.2 because I'm using macOS 10.12 and cannot run Xcode 9.3. Attempting to open PersonalizedAdConsent.xcodeproj or drag it into my project results in Xcode 9.2 presenting an error:

screen shot 2018-05-22 at 11 54 17

Looking at the contents of PersonalizedAdConsent.xcodeproj/project.pbxproj line 6 declares:

objectVersion = 50

My other Xcode projects have a value of 46. Manually changing the 50 to a 46 seems to work around the problem!

I suspect you're using an up-to-date Xcode 9.3 (and so should I, for that matter). Selecting the PersonalizedAdConsent project and inspecting the file in Xcode seems to let you choose the project format that it will be saved in:

screen shot 2018-05-22 at 11 56 44

It would be nice to get the project updated to be more compatible. But, for now, manually hacking the project file lets us continue.

Plans for this SDK

Could someone from Google give us an update as to the plans for this SDK.
In particular a version that can be more easily localised by developers.

Can't Get a Working Example of the Consent Form

Hello, I can't get a working example of the consent pop-up, below is how far I get and no form shows on the view controller, please show a working example, I was expecting a working example of the form in the github repo like admob ad examples so now i'm stuck after adding the code below from here: https://developers.google.com/admob/ios/eu-consent

import PersonalizedAdConsent
import UIKit

class FirstOnBoardingViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

    //Update consent status
    PACConsentInformation.sharedInstance.requestConsentInfoUpdate(
        forPublisherIdentifiers: ["pub-8306208638911728"])
    {(_ error: Error?) -> Void in
        if error != nil {
            // Consent info update failed.
        } else {
            // Consent info update succeeded. The shared PACConsentInformation
            // instance has been updated.
        }
    }

   //collect consent
    guard let privacyUrl = URL(string: "https://www.your.com/privacyurl"),
        let form = PACConsentForm(applicationPrivacyPolicyURL: privacyUrl) else {
            print("incorrect privacy URL.")
            return
    }
    form.shouldOfferPersonalizedAds = true
    form.shouldOfferNonPersonalizedAds = true
    form.shouldOfferAdFree = true

    //load consent form
    form.load {(_ error: Error?) -> Void in
        print("Load complete.")
        if let error = error {
            // Handle error.
            print("Error loading form: \(error.localizedDescription)")
        } else {
            // Load successful.
        }
    }

    //show consent form
    form.present(from: self) { (error, userPrefersAdFree) in
        if error != nil {
            // Handle error.
        } else if userPrefersAdFree {
            // User prefers to use a paid version of the app.
        } else {
            // Check the user's consent choice.
            _ =
                PACConsentInformation.sharedInstance.consentStatus
        }
    }
}

No Shared Prject Scheme

Carthage needs a shared project scheme to be able to manage this project. Seeing as Firebase is moving towards Carthage support it makes sense that this is also supported.

App icon without round corners on iOS

Apple recommends to use app icon without round corners.

[UIImage imageNamed:iconName]; loads and displays the rectangular icon. That doesn't look nice.

I would use this code to make the corners round. It's not the orignal rounding of Apple, but it looks better than rectangle.

/// Returns an icon with rounded corners.
static UIImage * roundCornerIcon(UIImage * icon)
{
    CGSize size = CGSizeMake(icon.size.width*icon.scale, icon.size.height *icon.scale);
    UIGraphicsBeginImageContextWithOptions(size, NO, 1.0);
    float radius = size.width * 0.25;
    [[UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width, size.height)
                                cornerRadius:radius] addClip];
    [icon drawInRect:CGRectMake(0, 0, size.width, size.height)];
    UIImage * roundCornerIcon = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return roundCornerIcon;
}

/// Returns the application's icon as a data URI string.
static NSString *_Nonnull PACIconDataURIString(void) {
  NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
  NSArray<NSString *> *iconFiles =
      infoDictionary[@"CFBundleIcons"][@"CFBundlePrimaryIcon"][@"CFBundleIconFiles"];
  NSString *iconName = iconFiles.lastObject;
  if (!iconName) {
    return @"";
  }
   
  UIImage *iconImage = roundCornerIcon([UIImage imageNamed:iconName]);
   
  NSData *iconData = UIImagePNGRepresentation(iconImage);
  NSString *iconBase64String = [iconData base64EncodedStringWithOptions:0];

  return [@"data:image/png;base64," stringByAppendingString:iconBase64String];
}

Problem with iOS EU Dialog when debugGeoLocation

Even if the flags are set as:

form.shouldOfferPersonalizedAds = YES;
form.shouldOfferNonPersonalizedAds = YES;
form.shouldOfferAdFree = YES;

only see two buttons in dialog, less relevant Ads and Ads free is this correct or something is missing?

screen shot 2018-06-12 at 2 24 43 pm

Change in behaviour. Urgent.

We have an app that has used the SDK since May 18 there have been no changes to our EU consent implementation. The current version of the app has been on the App Store for 3 months.
In the last week the consent form appears on almost every launch.
The only way this can happen is that inEEAOrUnkown is true followed by consent status being UNKOWN.
Has something changed with Google EU Consent status server?

load form crashes: if consent SDK is consumed via CocoaPods

In PACView.m, loadWebView method tries to obtain bundle url via:
NSURL *bundleURL = [[NSBundle mainBundle] URLForResource:@"PersonalizedAdConsent" withExtension:@"bundle"];
If host app is generated via CocoaPods, this is nil and results a crash. One possible fix is to replace the above with: [[NSBundle bundleForClass:[self class]] URLForResource:@"PersonalizedAdConsent" withExtension:@"bundle"] which would result $SAMPLE_APP_PATH/Frameworks/PersonalizedAdConsent.framework/PersonalizedAdConsent.bundle/ instead of non-existent $SAMPLE_APP_PATH/PersonalizedAdConsent.bundle/
A workaround solution is to change the documentation, so that even with CocoaPods setup, SDK consumers need to add PersonalizedAdConsent.bundle to Copy bundle resources manually.

Consent SDK Version 1.3 BUG!

Hello, when attempt to show form of this 1.3 version of the Consent SDK, Xcode throws a very strange error:

Consent SDK error

More specifically, this line of code is throwing that error:

** PACConsentStatus *status = PACConsentInformation.sharedInstance.consentStatus;**

Error: *Cannot initialize a variable of type 'PACConsentStatus ' with an rvalue of type 'PACConsentStatus'

Now, what's triggering this error and is that a bug with the Consent SDK?

Xcode Version 10.1 (10B61) used!

Please advice!

Nullable conflicts when compiling for an actual device

When I compile and run on an actual device I get the following error:

Conflicting nullability specifier on return types, 'nullable' conflicts with existing specifier 'nonnull'

In PACConsentForm.h:

/// Unavailable.
- (nullable instancetype)init NS_UNAVAILABLE;

Note: I have enabled Treat Warnings as Errors in my build settings. When I disable this setting everything works fine.

The easiest way to solve this suppress this would be the following (suppress the warning):

/// Unavailable.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability"
- (nullable instancetype)init NS_UNAVAILABLE;
#pragma clang diagnostic pop

But I'm not sure if this is such a good idea... 🤔

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.