Unable to Receive APNs Device Token in Unity iOS App Despite Proper Configuration

I’m currently developing an iOS app built in Unity, exported to Xcode for signing and deployment. The app needs to register for Apple Push Notifications (APNs) to retrieve the device token and register it with a backend service (PlayFab).

Despite enabling the required capabilities and entitlements, the app never receives a device token — the authorization request succeeds, but the token remains empty (req.DeviceToken is null in Unity).

I’ve confirmed that the issue occurs before PlayFab or Firebase are involved, meaning the app never receives the token from Apple Push Notification service (APNs) itself.

The Unity script I am using is:

#if UNITY_IOS using UnityEngine; using Unity.Notifications.iOS; using PlayFab; using PlayFab.ClientModels; using System.Collections; using System;

public class iOSPushInit : MonoBehaviour { private const int MaxRetries = 5; private const float RetryDelay = 2f; // seconds

void Start()
{
	Debug.Log("🛠 iOSPushInitDebug starting...");
    StartCoroutine(RequestAuthorizationAndRegister());
}

private IEnumerator RequestAuthorizationAndRegister()
{
	// Request Alert + Badge + Sound permissions and register for remote notifications
	var authOptions = AuthorizationOption.Alert | AuthorizationOption.Badge | AuthorizationOption.Sound;
	using (var req = new AuthorizationRequest(authOptions, true))
	{
    	Debug.Log("⏳ Waiting for user authorization...");

    	while (!req.IsFinished)
    	{
        	yield return null;
    	}

    	Debug.Log($"🔔 Authorization finished at {DateTime.Now}: granted={req.Granted}, error={req.Error}");

    	if (!req.Granted)
    	{
        	Debug.LogError("❌ User denied notification permissions! Cannot get APNs token.");
        	yield break;
    	}

    	// Authorization granted → check for device token
    	int attempt = 0;
    	string token = req.DeviceToken;
    	Debug.Log($"req.DeviceToken: {req.DeviceToken}");

    	while (string.IsNullOrEmpty(token) && attempt < MaxRetries)
    	{
        	attempt++;
        	Debug.Log($"ℹ️ APNs token not available yet. Attempt {attempt}/{MaxRetries}. Waiting {RetryDelay} seconds...");
        	yield return new WaitForSeconds(RetryDelay);
        	token = req.DeviceToken;
    	}

    	if (string.IsNullOrEmpty(token))
    	{
        	Debug.LogWarning("⚠️ APNs token still null after multiple attempts. Try again on next app launch.");
        	yield break;
    	}

    	Debug.Log($"📱 APNs Token acquired at {DateTime.Now}: {token}");

    	// Register with PlayFab
    	var request = new RegisterForIOSPushNotificationRequest
    	{
        	DeviceToken = token,
            SendPushNotificationConfirmation = false
    	};

        PlayFabClientAPI.RegisterForIOSPushNotification(request,
        	result => Debug.Log("✅ APNs token successfully registered with PlayFab."),
        	error => Debug.LogError("❌ Failed to register APNs token with PlayFab: " + error.GenerateErrorReport()));
	}
}

} #endif

When running on a real device (not simulator), the following is logged in Xcode:

🔔 Authorization finished: granted=True, error= ℹ️ APNs token not yet available. Try again on next app launch.

In the Xcode console, I do not see the expected APNs registration message: [Device] Registered for remote notifications with token: <...>

Environment Details:

Engine: Unity 6000.2.6f2

Notifications package: com.unity.mobile.notifications 2.4.2

Xcode: 16.4 (16F6)

iOS Device: iPhone 12, iOS 26.0.1

Testing Method: Building directly from Unity → Xcode → real device

Signing mode: Automatic (with correct Team selected)

Certificates in account: Apple Development certificate (active) Apple Distribution certificate (active)

Provisioning Profile:

Type: App Store (also tested Development profile)

Enabled Capabilities: Push Notifications, In-App Purchase

App ID Capabilities:

Push Notifications: Enabled

Development SSL certificate: Present

Production SSL certificate: Not generated (yet)

Background Modes -> remote notifications

What I Have Verified:

✅ Push Notifications capability is enabled in the Xcode target (not UnityFramework).

✅ Team and Bundle Identifier match my Apple Developer App ID.

✅ App ID has Push Notifications enabled in the Developer Portal.

✅ Tested on a real iOS device with working internet.

✅ Rebuilt and reinstalled app after enabling Push Notifications.

✅ Authorization dialog appears and permission is granted by user.

How can I resolve this issue?

The app needs to register for Apple Push Notifications (APNs) to retrieve the device token and register it with a backend service (PlayFab).

You need AppDelegate for that. If I remember correctly, it's phasing out, so I don't know how you do it without it, though.

Unable to Receive APNs Device Token in Unity iOS App Despite Proper Configuration
 
 
Q