Implementing iOS 14.5 Tracking Transparency in Expo SDK41

Starting with iOS 14.5, iPadOS 14.5, and tvOS 14.5, developers are required to ask users for permission to track.

Starting with iOS 14.5, iPadOS 14.5, and tvOS 14.5, developers are required to ask users for their permission to track them across apps and websites owned by other companies. This is part of Apple's push for a higher standard of privacy, security and content on the App Store.

If you're building a standard React Native app, you've got plenty of options available, namely react-native-tracking-transparency.

If you're an Expo user though, you'll notice that they've documented a new module called Expo Tracking Transparency in their docs. This module is actually a unimodule, aggregating the permission requesters found in expo-facebook, expo-ads-facebook and expo-ads-admob.

Unfortunately, it's not published to NPM yet (assuming it'll appear in SDK42) so in the meantime, you'll need to use one of the libraries above, e.g. Admob:

import { requestPermissionsAsync } from 'expo-ads-admob';
 
const { status } = await requestPermissionsAsync();
 
if (status == 'granted') {
  // Do your thing
} else {
  // No tracking for you
}

Once the new Tracking Transparency unimodule is released, you should be able to request tracking without adding the libraries above, e.g.

import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency';
 
useEffect(() => {
  (async () => {
    const { status } = await requestTrackingPermissionsAsync();
    if (status === 'granted') {
      // Do your thing
    } else {
      // No tracking for you
    }
  })();
}, []);

You'll also want to update your app config file (app.json or app.config.ts) with a ios.infoPlist.NSUserTrackingUsageDescription property, e.g.

ios: {
  infoPlist: {
    NSUserTrackingUsageDescription: 'We use Tracking to fix bugs and improve your experience.';
  }
}

Hope this helps!