skip to Main Content

I am trying to implement the Adjust SDK in both Android and iOS. In Android it is working fine, but the same code not working on iOS.

Following is my Adjust integration but if I console log status, I am getting status value as 0

I thought this is because of the Emulator issue, then did the build and tried it on real device but still getting the same issue. I am not sure what I am missing here

var adjustEvent = new AdjustEvent("xyzabc");
      Adjust.trackEvent(adjustEvent);
      Adjust.updateConversionValue(6);
      Adjust.getAppTrackingAuthorizationStatus((status) => {
        console.log("Authorization status = " + status);
      }); 

2

Answers


  1. Since iOS 14+, you need to request permission to track the user. The status code 0 might indicate a permission issue. Make sure you have implemented the ATT framework correctly.

    The first step to debug this would be with better error handling:

    var adjustEvent = new AdjustEvent("xyzabc");
    Adjust.trackEvent(adjustEvent);
    Adjust.updateConversionValue(6);
    Adjust.getAppTrackingAuthorizationStatus((status) => {
      if (status === 0) {
        console.error("Adjust SDK Error: Authorization status returned 0.");
        // Additional error handling or fallback logic here
      } else {
        console.log("Authorization status = " + status);
      }
    });
    
    Login or Signup to reply.
    1. You need to add NSUserTrackingUsageDescription to be able to request for permission to track user.
    <key>NSUserTrackingUsageDescription</key>
    <string>Privacy - Tracking Usage Description</string>
    
    1. After that you need to call Adjust.requestTrackingAuthorizationWithCompletionHandler like the example below:
    Adjust.trackEvent(adjustEvent);
    Adjust.updateConversionValue(6);
    Adjust.getAppTrackingAuthorizationStatus(status => {
      if (status === 0) {
        console.error('Adjust SDK Error: Authorization status returned 0.');
        // Additional error handling or fallback logic here
        Adjust.requestTrackingAuthorizationWithCompletionHandler(_status => {
          console.log('Authorization status updated:', {status: _status});
        });
      } else {
        console.log('Authorization status = ' + status);
      }
    });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search