The app does not use App Tracking Transparency to request the user's permission

My app’s update has been rejected by apple because it needs app tracking transparency. I have read several articles but I can’t solve the problem. My app was developed a few years ago, uses cordova and angular.

This is info command output from Windows O.S.

ionic info

Ionic:

   Ionic CLI                     : 7.2.0 (C:\tools\nvm\v18.16.0\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.7.4
   @angular-devkit/build-angular : 13.3.11
   @angular-devkit/schematics    : 12.2.18
   @angular/cli                  : 13.3.11
   @ionic/angular-toolkit        : 4.0.0

Cordova:

   Cordova CLI       : 11.1.0
   Cordova Platforms : android 11.0.0, browser 6.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 17 other plugins)

Utility:

   cordova-res                          : 0.15.4
   native-run (update available: 2.0.1) : 2.0.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\myuser\AppData\Local\Android\Sdk)
   NodeJS            : v18.16.0 (C:\Program Files\nodejs\node.exe)
   npm               : 9.5.1
   OS                : Windows 10

I tried to install this guide: GitHub - chemerisuk/cordova-plugin-idfa: Cordova plugin to get Advertising ID (IDFA or AAID)

  1. Installed plugin “cordova plugin add cordova-plugin-idfa”
  2. Configured config.xml. Add NSUserTrackingUsageDescription. for ios platform.
  3. Created methods “askTrackingPermission” and “readTrackingPermission”
  4. Called “askTrackingPermission” method from my app.component.ts initializeApp method after platform is ready
    this.platform.ready().then(() => {
      console.log("Asking for Traking Permission... BEFORE");
      this.askTrackingPermission();
      console.log("Asking for Traking Permission... AFTER");
    })

I receive error when run ionic serve: Property ‘cordova’ does not exist on type ‘Window & typeof globalThis’

[ng] Error: src/app/app.component.ts:256:18 - error TS2339: Property 'cordova' does not exist on type 'Window & typeof globalThis'.
[ng]
[ng] 256       if (window.cordova) {
[ng]                      ~~~~~~~
[ng]

Can you help me please?

try declaring a “cordova” variable like this declare var cordova: any; or a window variable declare var windos: any;, or remove that window.cordova check if the code is yours.

1 Like

Thanks @julio-ionic. Solved.

This is the solution.