Error - TypeError: null is not an object (evaluating 'TrackingTransparency.getTrackingStatus')
daangelov opened this issue · 4 comments
After installing the package and adding NSUserTrackingUsageDescription to my Info.plist I get an error "[TypeError: null is not an object (evaluating 'TrackingTransparency.getTrackingStatus')]" when calling getTrackingStatus(). Same happens with requestTrackingPermission().
I am experiancing this issue only when testing on a real device. On emulator it works fine.
My guess is that it appears because on the emulator the "Allow Apps to Request to Track" option in "Setting -> Privacy -> Tracking", is configurable, while on my physical device it stays "greyed out".
There are a couple discussions/threads about this greyed out buttons but nothing seams to make them interactable.
One workaround is to wrap the function call in a try catch block and if an error occurs, treat it as "not-determined".
Is this the expected behaviour or am I missing something?
Device: iPhone 8 (iOS 14.5)
Are you sure the native module has installed successfully?
Run pod install
and then rebuild the App (run it on your Phone).
Yes, everything is installed. As I said it works when running on a simulator with iOS 14.5 or lower.
Well the method should exist even if it is being run on an iOS version below 14.5:
so the only reason that TrackingTransparency.getTrackingStatus
can be null is if the native module has not been installed (that is, pod install + rebuild the app for your phone)
Can you put a breakpoint in that line to see if it gets invoked?
I restarted my iPhone, deleted node_module and ios/Pods, ran yarn install and pod install and now everything seem to work. The status returned is "restricted".
Sorry to bother you, thank you very much for your help, appreciate it!