adjust / unity_sdk

This is the Unity SDK of
http://www.adjust.com
MIT License
149 stars 70 forks source link

ATT Popup Not Displayed #295

Open providence94 opened 2 months ago

providence94 commented 2 months ago

I have an issue where im calling the the att popup using adjust code as shown below

Screenshot 2024-05-07 at 1 53 10 PM

However nothing shows up on screen I don't see the popup and statuscallback is called with the value 0 without any interaction from the user why would this be happening ?

providence94 commented 1 month ago

is anybody here who will respond here? or is this a dead space ?

uerceg commented 1 month ago

Hey @providence94,

We're definitely trying to keep the space alive, so sorry for the delay in replying.

Hm. I have just tested this method in my Unity app:

Adjust.requestTrackingAuthorizationWithCompletionHandler((status) =>
{
    Debug.Log(status);
    switch (status)
    {
        case 0:
            // ATTrackingManagerAuthorizationStatusNotDetermined case
            break;
        case 1:
            // ATTrackingManagerAuthorizationStatusRestricted case
            break;
        case 2:
            // ATTrackingManagerAuthorizationStatusDenied case
            break;
        case 3:
            // ATTrackingManagerAuthorizationStatusAuthorized case
            break;
    }
});

and I see the dialog being shown and also the Debug.Log reporting the proper value depending on the answer I give to the dialog. Not exactly sure what might be the issue you're facing. Here are a few thoughts:

Probably you have covered all of these, but just for sake of making sure everything's clean:

Also worth mentioning that Apple has introduced an ATT bug in iOS 17.4 which is responsible for some weird behavior when it comes to this entire flow (tl;dr: ATT dialog should still be displayed, however the callback was initially getting triggered always with 0, even before one provides an answer to the dialog). Not sure if this is related to your issue, but it's good to keep this in mind.

Looking forward to hear if potential reinstall test made the dialog to be shown again (you might as well try my code snippet, but I don't think there should be any difference).

providence94 commented 1 month ago

i see. im gonna have to check on this att bug. however what would make the code call the callback with a not determined response without showing the prompt to the user. how is this behaviour possible!?

uerceg commented 1 month ago

That's indeed a puzzling one. In theory ATT status should be 0 until you provide an answer to the ATT dialog after which it should switch to 2 (in case you refused to be tracked) or 3 (in case you consented to be tracked). In theory, if you never show the dialog, the ATT status will always have the value 0. And if one would invoke the ATT status getter from the native iOS API, this would return 0 to you. But that's not the method the Adjust Unity SDK is wrapping behind the requestTrackingAuthorizationWithCompletionHandler method of ours. We are wrapping and just forwarding the call to the ATT dialog showing method which should definitely try to show the dialog once invoked for the first time after app has been installed on the device.

Still curious to hear if you are facing the same issue (dialog not being shown && getting callback triggered with status being 0) after you make a call to this method after reinstalling your app.

providence94 commented 1 month ago

hey yeah its the same behaviour after doing multiple reinstalls basically the behaviour for me is is call the function ive shown above and immediately the callback gets called with "0" im puzzled how that happens

also I used to have ATT tracking switched off in the settings and to test this I switched it on does this have anything to do with how the att is supposed to work ?

providence94 commented 1 month ago
Adjust Initializing
<InitAdjust>d__29:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
<doATTPopup>d__12:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
LaserSharpGameloader:InitializeComponents()

    [Adjust]w: PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
    Adjust Initialized
<InitAdjust>d__29:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

trackingStatus : 0
<doATTPopup>d__12:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

UnityIAP UnityEarlyTransactionObserver: Added to the payment queue
DEBUG: Auth state changed. Notifying 1 listeners.
Auth state changed. Notifying 1 listeners.
DEBUG: ID token changed. Notifying 1 listeners.
ID token changed. Notifying 1 listeners.
UnityIAP: Requesting product data...
DEBUG: ID token changed. Notifying 1 listeners.
ID token changed. Notifying 1 listeners.
Searching for selector applicationDidBecomeActive: (FIRA30f8c8e8applicationDidBecomeActive:) on class GUL_SingularAppDelegate-466465EB-2755-4543-B237-544C4650BE08
Found applicationDidBecomeActive: (FIRA30f8c8e8applicationDidBecomeActive:, 0x0f72df74) on class GUL_SingularAppDelegate-466465EB-2755-4543-B237-544C4650BE08 (GUL_SingularAppDelegate-466465EB-2755-4543-B237-544C4650BE08)
-> applicationDidBecomeActive()
trackingStatus post request : 0
GDPRPopUpUI:<doATTPopup>b__12_1(Int32)
com.adjust.sdk.Adjust:GetAuthorizationStatus(String)

I see these things in the logs I init adjust sdk first and then call the ATT popup because if I call the ATT popup first it says Adjust SDK not initialised so then I do the init first and then call the popup immediately after I do the call to the popup the callback is immediately called

@uerceg

providence94 commented 1 month ago

I would also like to know if having different sdks might cause this issue if some Delegate classes are being overridden or some callbacks are being intercepted or not called or something like this for this kind of issue to happen

providence94 commented 1 month ago

I am running the latest 17.5 version and at least in the above apple forum they say its fixed in 17.5 version but I still don't have it

providence94 commented 1 month ago

@uerceg bump

providence94 commented 1 month ago

@uerceg bump again

uerceg commented 1 month ago

Hey @providence94,

In theory, having different SDKs should not be causing issues. Technically, one could maybe try to play around with swizzling, but personally I haven't tried it, so not sure how far in manipulation one can go with that approach.

Are you using iOS 17.5 or 17.5.1 on your device?

providence94 commented 1 month ago

im using 17.5.1.

anyways for the time being ive switched to using Unity iOS advertising support package v1.2 for ATT popup purposes. it worked right out of the box.