Firebase logs stopped working as soon as updated to iOS 14.5 for one of the react-native app I am working on.
What are the necessary changes that we need to do to make it working again?
Firebase logs stopped working as soon as updated to iOS 14.5 for one of the react-native app I am working on.
What are the necessary changes that we need to do to make it working again?
You need to request Tracking permissions first (I used react-native-permissions):
import { request, RESULTS, PERMISSIONS } from 'react-native-permissions'
import { Settings } from 'react-native-fbsdk-next'
export const requestPermissionTransparency = async () => {
return await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY)
}
useEffect(() => {
;(async () => {
const result = await requestPermissionTransparency()
if (result === RESULTS.GRANTED) {
await firebase.analytics().setAnalyticsCollectionEnabled(true)
await Settings.setAdvertiserTrackingEnabled(true)
} else {
await firebase.analytics().setAnalyticsCollectionEnabled(false)
await Settings.setAdvertiserTrackingEnabled(false)
}
})()
}, [])
Remember to add this file in the root project:
// <project-root>/firebase.json
{
"react-native": {
"analytics_auto_collection_enabled": false
}
}
References: https://rnfirebase.io/analytics/usage