Skip to content

How to Fix iOS Push Notification Not Received

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about How to Fix iOS Push Notification Not Received. We cover key concepts, practical examples, and best practices.

The Problem

Your app registers for remote notifications but they never arrive:

Failed to register: Error Domain=NSCocoaErrorDomain Code=3010
"Remote notifications are not supported in the simulator"

Or notifications work in development but not in production.

Quick Fix

Step 1: Enable push notifications capability

In Xcode: Target > Signing & Capabilities > + > Push Notifications.

Also enable Background Modes > Remote notifications.

Step 2: Register for remote notifications in code

import UserNotifications

// Request authorization
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
    guard granted else { return }
    DispatchQueue.main.async {
        UIApplication.shared.registerForRemoteNotifications()
    }
}

Step 3: Implement the delegate methods

func application(_ application: UIApplication,
                 didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let tokenString = deviceToken.map { String(format: "%02x", $0) }.joined()
    // Send tokenString to your server
}

func application(_ application: UIApplication,
                 didFailToRegisterForRemoteNotificationsWithError error: Error) {
    print("Failed to register: \(error)")
}

Step 4: Use a physical device for testing

The simulator does not support remote push notifications. Test on a real device with a valid Apple Developer account.

Step 5: Verify APNs certificate

For production push, generate a Universal APNs Certificate (not a Development certificate) on developer.apple.com.

In your server, use the correct APNs endpoint:

Environment Host
Development api.sandbox.push.apple.com
Production api.push.apple.com

Step 6: Test with a push tool

# Using knuff or Pusher GUI tool
# Payload example:
{
    "aps": {
        "alert": "Hello!",
        "sound": "default",
        "badge": 1
    }
}

Use a push testing tool to send a test notification directly to the device token before relying on your server.

Step 7: Check bundle identifier match

The APNs certificate must match the app's bundle ID exactly. A mismatch causes silent delivery failure.

Step 8: Handle notification content extensions

For rich notifications (images, video), add a Notification Service Extension target:

override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
    // Download and attach media
}

Prevention

  • Register for remote notifications only after obtaining user permission.
  • Send the device token to your server every time didRegisterForRemoteNotificationsWithDeviceToken is called.
  • Test push notifications before every release.

Common Mistakes with push notification

  1. Using foldl instead of foldl' causing stack overflow on large lists
  2. Forgetting deriving (Show, Eq) on custom data types needed for debugging
  3. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable

These mistakes appear frequently in real-world IOS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Why does push work in development but not production?

The APNs endpoint differs (sandbox vs production). Your server may be using the sandbox endpoint when pushing to the production app. Also check the APNs certificate type.

Can push notifications be received when the app is killed?

Yes. iOS delivers notifications to the notification center regardless of app state. The content-available: 1 flag enables silent background delivery.

How long is a device token valid?

A device token can change after an OS restore, app reinstall, or when the user restores from a backup. Always query the current token on every launch.

DodaTech Tool Reference

Doda Browser's Notification Tester can simulate push notification delivery to connected devices, helping debug payload formatting and display issues.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro