2

I'm trying to publish my first IOS app and running into an issue with AppTrackingTransparency showing up on specifically Ipad.

IOS 16 used

Tested on Iphone 11/12/13 works fine and the AppTracking notification pops up. On any Ipad the "Allow/Don't Allow" never shows up and just shows the background.

Is there a difference between how Apple handles the request on Ipad/Iphone? Any info/help would be great. This is the only thing standing between me and my app being published!

Code:

using Unity.Advertisement.IosSupport.Components;
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

`namespace Unity.Advertisement.IosSupport.Samples
{
    /// <summary>
    /// This component will trigger the context screen to appear when the scene starts,
    /// if the user hasn't already responded to the iOS tracking dialog.
    /// </summary>
    public class ContextScreenManager : MonoBehaviour
    {
        /// <summary>
        /// The prefab that will be instantiated by this component.
        /// The prefab has to have an ContextScreenView component on its root GameObject.
        /// </summary>
        public ContextScreenView contextScreenPrefab;

        void Start()
        {
            // check with iOS to see if the user has accepted or declined tracking
            var status = ATTrackingStatusBinding.GetAuthorizationTrackingStatus();

            if (status == ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED)
            {
                var contextScreen = Instantiate(contextScreenPrefab).GetComponent<ContextScreenView>();

                // after the Continue button is pressed, and the tracking request
                // has been sent, automatically destroy the popup to conserve memory
                contextScreen.sentTrackingAuthorizationRequest += () => Destroy(contextScreen.gameObject);
            }
            StartCoroutine(LoadNextScene());
        }

        private IEnumerator LoadNextScene()
        {
            Debug.Log("load next scene called");
            var status = ATTrackingStatusBinding.GetAuthorizationTrackingStatus();

            while (status == ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED)
            {
                Debug.Log("not determined");
                status = ATTrackingStatusBinding.GetAuthorizationTrackingStatus();
                yield return null;
            }
            if(status == ATTrackingStatusBinding.AuthorizationTrackingStatus.DENIED || status == ATTrackingStatusBinding.AuthorizationTrackingStatus.RESTRICTED || status == ATTrackingStatusBinding.AuthorizationTrackingStatus.RESTRICTED)
            {
                Debug.Log("consent is no");
                PlayerPrefs.SetString("adConsent", "N");
            }
            else
            {
                Debug.Log("consent is yes");
                PlayerPrefs.SetString("adConsent", "Y");
            }
            SceneManager.LoadScene(1);
            yield return null;
        }
    }   
}

using System;
using UnityEngine;

namespace Unity.Advertisement.IosSupport.Components
{
    /// <summary>
    /// This component controls an iOS App Tracking Transparency context screen.
    /// You should only have one of these in your app.
    /// </summary>
    public sealed class ContextScreenView : MonoBehaviour
    {
        /// <summary>
        /// This event will be invoked after the ContinueButton is clicked
        /// and after the tracking authorization request has been sent.
        /// It's a good idea to subscribe to this event so you can destroy
        /// this GameObject to free up memory after it's no longer needed.
        /// Once the tracking authorization request has been sent, there's no
        /// need for this popup again until the app is uninstalled and reinstalled.
        /// </summary>
        public event Action sentTrackingAuthorizationRequest;

        public void RequestAuthorizationTracking()
        {
            Debug.Log("Unity iOS Support: Requesting iOS App Tracking Transparency native dialog. For Global Leaderboards & Revives this has to be accepted.");

            ATTrackingStatusBinding.RequestAuthorizationTracking();

            sentTrackingAuthorizationRequest?.Invoke();
        }
    }
}
John Ward
  • 21
  • 1
  • Is „Allow apps to request to track“ enabled on your iPad? It‘s in the system settings under „privacy & security“ then „tracking“. – JeanLuc Apr 15 '23 at 21:26

0 Answers0