{
  "id": 22727938,
  "title": "How to Add Images to iOS Push Notifications With a Notification Service Extension",
  "url": "https://urgent.news/2026/11/30/how-to-add-images-to-ios-push-notifications-with-a-notification",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-30T04:46:25.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/aryansbtloe/how-to-add-images-to-ios-push-notifications-with-a-notification-service-extension-4f4d"
  },
  "original_language": null,
  "account": "iOS push notifications can display images, enhancing user engagement. This is achieved through a Notification Service Extension (NSE), a small component that modifies incoming alerts before they're presented. Here's how it works:\n\n1. The Notification Service Extension is triggered by APNs when it receives an alert notification with \"mutable-content\": 1 in its aps dictionary. iOS first notifies the NSE, which can then alter the title, body, or badge, download a file, and attach it to the notification.\n\n2. If the NSE doesn't finish processing within 30 seconds, iOS defaults to a fallback method, showing either the modified content or the original notification.\n\n3. The NSE only runs for alert notifications, not silent ones (content-available only). Also, \"mutable-content\" must be the integer 1, not the string \"1\" or true.\n\n4. To set up the extension, create a Notification Service Extension target in Xcode. Ensure the bundle ID is prefixed by your app's bundle ID, and the deployment target doesn't exceed the iOS version on your test device. The extension is embedded in the app target, and no separate Push Notifications capability is required.\n\n5. The payload sent to the server includes an image_url key outside the aps dictionary. This URL points to the image to be displayed in the notification.\n\n6. The extension code, written in Swift, handles the received notification request. It first attempts to copy the mutable content and extract the image URL from the userInfo dictionary. If successful, it downloads the image file using URLSession. Once downloaded, the attachment is added to the content's attachments array, and the updated content is sent back to the system using contentHandler. If time runs out before processing completes, the serviceExtensionTimeWillExpire method is called, delivering the best available content to the user.",
  "summary": "A plain push notification is a title and a line of text. Add a photo, a product shot or a map thumbnail and people actually look at it. On iOS that's done with a Notification Service Extension (NSE): a small target that gets a chance to modify each incoming alert before it's shown. This guide walks through the whole thing, from payload to debugging, with code you can paste. 1. How it works When…",
  "summary_source": "publisher",
  "key_points": [],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}