react-native-tracking-transparency icon indicating copy to clipboard operation
react-native-tracking-transparency copied to clipboard

requestTrackingPermission crash the app [OS 14.5.1]

Open OleksiyTrofimenko opened this issue 3 years ago • 10 comments

Hi, thank you for your library. I've set up action inside my root component, to call prompt modal

It's very simple but anyway app crashed when requestTrackingPermission() triggered

`const onCheckUserTrackingPermission = useCallback(async () => { try { const trackingStatus = await getTrackingStatus();

  if (trackingStatus === 'not-determined') {
    return await requestTrackingPermission();
  }

  if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
    return;
  }
} catch (error) {}

}, []);

useEffect(() => { onCheckUserTrackingPermission(); }, [onCheckUserTrackingPermission]);

OleksiyTrofimenko avatar May 13 '21 10:05 OleksiyTrofimenko

Can you share the crashlogs? Check your native logs window in Xcode.

Did you edit your Info.plist to add a tracking info description?

mrousavy avatar May 13 '21 12:05 mrousavy

@mrousavy, unfortunately, logs are clear, through the cycle of executing my component, I've used a log to this case

and the last message that I've faced it's status of const trackingStatus = await getTrackingStatus();

that shows not-determined

Yes, I edit Info.plist and added the required key with the description. The problem that on the emulator everything works fine, but on real device, after requestTrackingPermission called, my app crashed

OleksiyTrofimenko avatar May 13 '21 13:05 OleksiyTrofimenko

I have NSUserTrackingUsageDescription in my Info.plist and I remember this was working before this version. I have error for message: :"null is not an object (evaluating 's.requestTrackingPermission') and name: TypeError

      const trackingStatus = await requestTrackingPermission();
      logInfoInstabug(trackingStatus, 'trackingStatus');
      report(trackingStatus, 'trackingStatus:');
    } catch (e) {
      report(e, 'requestTrackingPermission() Error');
      reportErrorInstabug(e, 'requestTrackingPermission() Error');
    }

axeljeremy7 avatar May 18 '21 20:05 axeljeremy7

I have the same error "null is not an object (evaluating 'TrackingTransparency.getTrackingStatus')"

How can I solve this? @mrousavy

Giacomo92 avatar May 19 '21 15:05 Giacomo92

Hey guys. Removing the app from simulator/real device, removing Pods folder, reinstalling pods and reseting the metro cache with react-native start --reset-cache did work for me.

ViktorVojtek avatar May 20 '21 20:05 ViktorVojtek

I have the same error "null is not an object (evaluating 'TrackingTransparency.getTrackingStatus')"

How can I solve this? @mrousavy

I have NSUserTrackingUsageDescription in my Info.plist and I remember this was working before this version. I have error for message: :"null is not an object (evaluating 's.requestTrackingPermission') and name: TypeError

      const trackingStatus = await requestTrackingPermission();
      logInfoInstabug(trackingStatus, 'trackingStatus');
      report(trackingStatus, 'trackingStatus:');
    } catch (e) {
      report(e, 'requestTrackingPermission() Error');
      reportErrorInstabug(e, 'requestTrackingPermission() Error');
    }

I also had the same situation as you. I try adding pod 'react-native-tracking-transparency', :path => '../node_modules/react-native-tracking-transparency' in Podfile then pod install. This work for me.

ncthang198 avatar May 21 '21 08:05 ncthang198

I have the same error "null is not an object (evaluating 'TrackingTransparency.getTrackingStatus')" How can I solve this? @mrousavy

I have NSUserTrackingUsageDescription in my Info.plist and I remember this was working before this version. I have error for message: :"null is not an object (evaluating 's.requestTrackingPermission') and name: TypeError

      const trackingStatus = await requestTrackingPermission();
      logInfoInstabug(trackingStatus, 'trackingStatus');
      report(trackingStatus, 'trackingStatus:');
    } catch (e) {
      report(e, 'requestTrackingPermission() Error');
      reportErrorInstabug(e, 'requestTrackingPermission() Error');
    }

I also had the same situation as you. I try adding pod 'react-native-tracking-transparency', :path => '../node_modules/react-native-tracking-transparency' in Podfile then pod install. This work for me.

It's still crashing :(

karthick-t2s avatar Jun 09 '21 09:06 karthick-t2s

Have you added NSUserTrackingUsageDescription to info.plist?

teivienn avatar Jun 16 '21 14:06 teivienn

pod 'react-native-tracking-transparency', :path => '../node_modules/react-native-tracking-transparency'

Works for me too.

piyushbeli avatar Jul 13 '21 17:07 piyushbeli

Hey guys. Removing the app from simulator/real device, removing Pods folder, reinstalling pods and reseting the metro cache with react-native start --reset-cache did work for me.

Thank you so much for this solution. Have been stuck at this, and this fixed the issue. I am unsure why or which step solved it, but it works now!

react: 16.11.0
react-native: 0.62.2
react-native-tracking-transparency 0.1.1

vladdeSV avatar Dec 08 '21 16:12 vladdeSV