Fix: Silent Push Notifications Not Waking App in Background on iOS

Fix: Silent Push Notifications Not Waking App in Background on iOS
Quick answer: Silent pushes require the remote-notification background mode in Info.plist and a payload with content-available: 1 but no alert, sound, or badge. The app gets ~30 seconds in application(_:didReceiveRemoteNotification:fetchCompletionHandler:) unless the user force-quit it.

Why this happens

Silent push notifications are designed to refresh content without alerting the user. When they fail to wake the app, the cause is almost always one of three configuration mistakes:

  1. Missing background capability – The UIBackgroundModes key with remote-notification is absent from Info.plist, so iOS never launches the app for the payload.
  2. Malformed payload – Including alert, sound, or badge keys (or omitting content-available: 1) turns the notification into a user-visible one, which the system may throttle or deliver differently.
  3. App state – If the user force-quit the app, iOS will not relaunch it for a silent push; the app must be in the suspended or background state.

Additionally, the system enforces a strict ~30-second wall-clock limit. If your completion handler isn’t called in time, the app is suspended and future silent pushes may be delayed.

How to fix it

1. Declare the background mode in Info.plist

Open your target’s Info.plist (or the project’s Signing & Capabilities tab) and add Background Modes → Remote notifications. This inserts the required key:

<key>UIBackgroundModes</key>
<array>
    <string>remote-notification</string>
</array>

Without this, application(_:didReceiveRemoteNotification:fetchCompletionHandler:) is never invoked.

2. Send a strictly silent payload

The APNs JSON must contain content-available: 1 inside aps and must not include alert, sound, or badge. A minimal valid payload:

{
  "aps": {
    "content-available": 1
  },
  "custom-key": "custom-value"
}

If you need to silence an explicit sound key, set "sound": "" (empty string), but the cleaner approach is to omit it entirely. Any user-visible key causes the push to be treated as a normal notification and defeats the silent purpose.

3. Implement the fetch completion handler

In your AppDelegate (or UIApplicationDelegate adopter), handle the callback and always call the completion handler:

import UIKit

class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication,
                     didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                     fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        // 1. Extract custom data
        guard let custom = userInfo["custom-key"] as? String else {
            completionHandler(.failed)
            return
        }

        // 2. Perform background work (network, DB, etc.)
        Task {
            do {
                try await syncContent(with: custom)
                completionHandler(.newData)
            } catch {
                completionHandler(.failed)
            }
        }
    }

    private func syncContent(with identifier: String) async throws {
        // Your background fetch logic here
    }
}

Key points:
– Call completionHandler(.newData) when you downloaded something, .noData when nothing changed, .failed on error.
– The handler must be called; otherwise the system kills the background task after ~30 seconds.
– Use structured concurrency (Task) or a background URLSession to stay within the time budget.

4. Test with the correct app state

  • Suspended in background – Silent push wakes the app, handler runs.
  • Foreground – Handler runs immediately.
  • Force-quit by user – App is not launched; silent push is discarded. This is expected behavior.

Use the Console app (filter by your bundle ID) or Xcode’s device log to verify application:didReceiveRemoteNotification:fetchCompletionHandler: is invoked.

How to prevent it

  • Keep the remote-notification background mode enabled in every build configuration.
  • Validate payloads on your server: automated tests should reject any APNs JSON containing alert, sound, or badge when content-available: 1 is present.
  • Measure background task duration in CI; aim for < 10 seconds to leave margin.
  • Handle .failed gracefully so a single bad fetch doesn’t block future silent pushes.
  • Document the force-quit limitation for product owners—silent pushes cannot guarantee delivery in that state.

FAQ

Why does my silent push work in Debug but not in TestFlight?

TestFlight builds use the production APNs environment. Ensure your server sends to api.push.apple.com (not the sandbox gateway) and that the provisioning profile includes the aps-environment: production entitlement.

Can I schedule a local notification from a silent push handler?

Yes. Inside fetchCompletionHandler you may call UNUserNotificationCenter.current().add(request) to show a user-visible notification after fetching data. This is a common pattern for “new content available” alerts.

Does Low Power Mode block silent pushes?

Low Power Mode reduces the frequency of background app refresh, but silent pushes with content-available: 1 are still delivered. The 30-second execution window remains unchanged.

Sources & credits

Parts of this guide are adapted from content licensed under CC BY-SA 3.0; this article is shared under the same license.