I'm working on an app that syncs with Apple Health events. Every time an event occurs, the app should send a notification.
The problem occurs when the app is backgrounded or force-closed; it can no longer send local notifications, and because these events can occur at any time, scheduled notifications can't be used.
I'm just wondering if anyone's found a creative way around this. I know we can't override system behaviour, I'm just thinking of other alternative solutions for the matter.
Notifications
RSS for tagLearn about the technical aspects of notification delivery on device, including notification types, priorities, and notification center management.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Having voice control enabled now puts three menu bar items. The blue icon it has always had, supplemented with an orange microphone and an orange dot next to control center. I know this orange icon is there to notify me that a third-party application is accessing the microphone, but this is a first-party system service that is always running. If another app starts accessing the microphone I won't know, since the orange icon is always there anyway. It's like a California prop 65 warning. Maybe it was a good idea in principal but with it being ubiquitous everyone just ignores it. Siri is also always accessing the microphone, but doesn't trigger this orange eyesore because it's a system service. Both Siri and voice control are always on in the background, are first-party system services that must be specifically enabled, and both have their own menu bar icon that can be removed if not wanted. This orange icon with voice control potentially introduces MORE risk by training me to ignore the orange icon. Please return to the pre-26.3 behaviour of using this orange icon for third-party apps and not first-party system services.
FB22036182 -- "Voice control causes extra menu bar icon"
Topic:
App & System Services
SubTopic:
Notifications
Device: iPhone (real device)
iOS: 17.x
Permission: Granted
Notifications are scheduled using UNCalendarNotificationTrigger.
The function runs and prints "SCHEDULING STARTED".
However, notifications never appear at 8:00 AM, even the next day.
Here is my DailyNotifications file code:
import Foundation
import UserNotifications
enum DailyNotifications {
// CHANGE THESE TWO FOR TESTING / PRODUCTION
// For testing set to a few minutes ahead
static let hour: Int = 8
static let minute: Int = 0
// For production use:
// static let hour: Int = 9
// static let minute: Int = 0
static let daysToSchedule: Int = 30
private static let idPrefix = "daily-thought-"
private static let categoryId = "DAILY_THOUGHT"
// MARK: - Permission
static func requestPermission(completion: @escaping (Bool) -> Void) {
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .sound]) { granted, _ in
DispatchQueue.main.async {
completion(granted)
}
}
}
// MARK: - Schedule
static func scheduleNext30Days(isPro: Bool) {
print("SCHEDULING STARTED")
let center = UNUserNotificationCenter.current()
center.getNotificationSettings { settings in
guard settings.authorizationStatus == .authorized else {
requestPermission { granted in
if granted {
scheduleNext30Days(isPro: isPro)
}
}
return
}
// Remove old scheduled notifications
center.getPendingNotificationRequests { pending in
let idsToRemove = pending
.map { $0.identifier }
.filter { $0.hasPrefix(idPrefix) }
center.removePendingNotificationRequests(withIdentifiers: idsToRemove)
let calendar = Calendar.current
let now = Date()
for offset in 0..<daysToSchedule {
guard let date = calendar.date(byAdding: .day, value: offset, to: now) else { continue }
var comps = calendar.dateComponents([.year, .month, .day], from: date)
comps.hour = hour
comps.minute = minute
guard let scheduleDate = calendar.date(from: comps) else { continue }
if scheduleDate <= now { continue }
let content = UNMutableNotificationContent()
content.title = "Just One Thought"
content.sound = .default
content.categoryIdentifier = categoryId
if isPro {
content.body = thoughtForDate(scheduleDate)
} else {
content.body = "Your new thought is ready. Go Pro to reveal it."
}
let triggerComps = calendar.dateComponents(
[.year, .month, .day, .hour, .minute],
from: scheduleDate
)
let trigger = UNCalendarNotificationTrigger(
dateMatching: triggerComps,
repeats: false
)
let identifier = idPrefix + isoDay(scheduleDate)
let request = UNNotificationRequest(
identifier: identifier,
content: content,
trigger: trigger
)
center.add(request)
}
}
}
}
// MARK: - Cancel
static func cancelAllScheduledDailyThoughts() {
let center = UNUserNotificationCenter.current()
center.getPendingNotificationRequests { pending in
let idsToRemove = pending
.map { $0.identifier }
.filter { $0.hasPrefix(idPrefix) }
center.removePendingNotificationRequests(withIdentifiers: idsToRemove)
}
}
// MARK: - Helpers
private static func isoDay(_ date: Date) -> String {
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en_US_POSIX")
formatter.dateFormat = "yyyy-MM-dd"
return formatter.string(from: date)
}
private static func thoughtForDate(_ date: Date) -> String {
guard let url = Bundle.main.url(forResource: "thoughts", withExtension: "json"),
let data = try? Data(contentsOf: url),
let quotes = try? JSONDecoder().decode([String].self, from: data),
!quotes.isEmpty
else {
return "Stay steady. Your growth is happening."
}
let calendar = Calendar.current
let comps = calendar.dateComponents([.year, .month, .day], from: date)
let seed =
(comps.year ?? 0) * 10000 +
(comps.month ?? 0) * 100 +
(comps.day ?? 0)
let index = abs(seed) % quotes.count
return quotes[index]
}
}
Then here is my Justonethoughtapp code:
import SwiftUI
import UserNotifications
@main
struct JustOneThoughtApp: App {
@StateObject private var thoughtStore = ThoughtStore()
// MUST match App Store Connect EXACTLY
@StateObject private var subManager =
SubscriptionManager(productIDs: ["Justonethought.monthly"])
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(thoughtStore)
.environmentObject(subManager)
.onAppear {
// Ask for notification permission
NotificationManager.shared.requestPermission()
// Schedule notifications using PRO status
DailyNotifications.scheduleNext30Days(
isPro: subManager.isPro
)
}
}
}
}
final class NotificationManager {
static let shared = NotificationManager()
private init() {}
func requestPermission() {
UNUserNotificationCenter.current().requestAuthorization(
options: [.alert, .sound, .badge]
) { _, _ in }
}
}
Hello,
I am developing a driver-based application targeting iOS 14+, where users receive time-sensitive trip offers (approximately 10–15 seconds to respond).
We would like to implement behavior similar to approval-based apps (e.g., MyGate-style interaction), with the following requirements:
When the device is locked:
A highly visible notification that allows quick Accept / Decline action.
When the device is unlocked (foreground or background):
A notification that remains prominently visible (sticky-style) at the top of the screen until the user takes action (Accept / Decline) or the offer expires.
Our goal is to ensure the offer remains noticeable and actionable within the short response window.
I would appreciate clarification on the following:
On iOS 14, is there any supported mechanism to present a true full-screen blocking interface while the device is locked (without using CallKit or Critical Alerts entitlement)?
Is there a supported way to make a notification persistent or non-dismissible until the user takes action or the offer expires?
Are there any App Review concerns with presenting a blocking modal immediately after the user interacts with a notification?
We want to ensure full compliance with Apple’s platform guidelines and avoid unsupported or discouraged patterns.
Thank you for your guidance.
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
Notification Center
User Notifications
Hello Apple Developer Support,
We are observing inconsistent behavior with push notification sounds routing to Bluetooth / external speakers.
Our app sends push notifications with a custom sound file using the sound parameter in the APNs payload. When an iPhone is connected to a Bluetooth speaker or headphones:
On some devices, the notification sound plays through the connected Bluetooth/external speaker.
On other devices, the notification sound plays only through the iPhone’s built-in speaker.
We also tested with native apps like iMessage and noticed similar behavior — in some cases, notification sounds still play through the phone speaker even when Bluetooth is connected.
Media playback (e.g., YouTube or Music) routes correctly to Bluetooth, so the connection itself is functioning properly.
We would like clarification on the following:
Is this routing behavior expected for push notification sounds?
Are notification sounds intentionally restricted from routing to Bluetooth in certain conditions (e.g., device locked, system policy, audio session state)?
Is there any supported way to ensure notification sounds consistently route through connected Bluetooth/external speakers?
The inconsistent behavior across devices makes it difficult to determine whether this is by design or a configuration issue.
Thank you for your guidance.
Hello! We've had reports of iOS devices 'waking up' and vibrating in response to the push notifications arriving but the notification itself is not being displayed to the user, despite having been granted the correct permissions. Is this a known issue?
iOS app crashes on launch after updating and adding push notifications, but no crash logs are received; however, it works fine after restart. What could be the reason?
launch failed, RBSProcessExitContext voluntary
Problem Description
Location-based notifications added with UNLocationNotificationTrigger and CLCircularRegion do not fire consistently when the user enters the monitored region. Sometimes they work, sometimes they do not. In tests where the user physically enters the region and waits several days, the notification often never triggers.
What we’ve confirmed
Notification permission is granted
Location permission is set to “Always”
The notification request is successfully added (no error from UNUserNotificationCenter.add)
Pending notification requests are present when checked with getPendingNotificationRequests
CLLocationManager didEnterRegion / didExitRegion work when we monitor the same region via startMonitoring(for:)
UNLocationNotificationTrigger behavior is inconsistent and unreliable in our tests
Reproduction Steps
Launch the app and grant notification permission and “Always” location permission
Add a region notification (either by current GPS location or by selecting a point from MKLocalSearch)
Leave the monitored region
Later, physically return into the region
Expected: a notification is delivered when entering the region
Actual: the notification often does not appear, even after waiting days
Our Hypothesis: Coordinate System Mismatch in China
We suspect the issue may be related to coordinate systems in mainland China.
In China, Apple MapKit and MKLocalSearch use GCJ-02 (the “Mars” coordinate system required by local regulations).
Device GPS and CLCircularRegion / Core Location use WGS-84.
If an app supplies GCJ-02 coordinates to CLCircularRegion (e.g. from MapKit or search), the region center may be offset by hundreds of meters from the actual WGS-84 position. That could make the system’s “inside region” check fail, even when the user is physically inside the intended area.
Questions for Apple
Does CLCircularRegion (and therefore UNLocationNotificationTrigger) expect coordinates in WGS-84? If so, should apps in China convert GCJ-02 to WGS-84 before passing coordinates to CLCircularRegion?
Is there any official guidance or documentation for handling coordinate systems when using location-based notifications in mainland China?
Are there known limitations or special requirements for UNLocationNotificationTrigger in China (e.g. coordinate system, accuracy, or system behavior) that could explain intermittent or missing triggers?
I'm having a reproducible problem receiving push notifications on macOS 26.2.
The pattern is that the push is received and then discarded almost immediately (there is a 60s expiration date) when on battery power and then when I plug in pushes start working and even if I unplug again it works for hours until breaking again.
These are alert notifications with priority 10.
Other team members have had similar problems but less reliably broken and even get a "stored for device power considerations" message followed by discarded (see apns-unique-id c29250a3-abbf-008a-96f9-a5384e32d1df).
An example from my machine with the apns-unique-id 6b2dfe3d-af99-182a-0e1e-6b811d3ec486 which fails immediately.
iOS is working fine however so this seems to be confined to macOS only.
I'm sending local push notifications and want to show specific content based on the id of any notification the user opens. I'm able to do this with no issues when the app is already running in the background using the code below.
final class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate {
let container = AppContainer()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
let center = UNUserNotificationCenter.current()
center.delegate = self
return true
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: () -> Void) {
container.notifications.handleResponse(response)
completionHandler()
}
}
However, the delegate never fires if the app was terminated before the user taps the notification. I'm looking for a way to fix this without switching my app lifecycle to UIKit.
This is a SwiftUI lifecycle app using UIApplicationDelegateAdaptor.
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
I’m aware notification responses may be delivered via launchOptions on cold start, but I’m unsure how to bridge that cleanly into a SwiftUI lifecycle app without reverting to UIKit.
We have been experimenting with silent notifications to update the content in our app and connected bluetooth peripheral at regular intervals. We are facing issues every once in a while with some users not receiving the notifications reliably even if the app is in the background and not killed.
Is there a way we can ensure we reliably receive notifications every time without any issues? If there is no guaranteed delivery with silent notifications, then is there any other way that we can explore to achieve our use case?
Is there any information for developer about notification forwarding which is published in iOS 26.3? how to use it ?
Im creating a basic app, needs push notification capability. I have created two profiles (development & distribution), selected my app in Identifiers and checked the PN box to enable it (no need for broadcast). I add the profile to Xcode and it says "Provisioning profile "New VP App Jan 2026" doesn't include the Push Notifications capability."
What am I missing?
Topic:
App & System Services
SubTopic:
Notifications
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?
Topic:
App & System Services
SubTopic:
Notifications
Hi, happy new year, I'm a Product Manager for a communications app that's currently in testflight. We requested the com.apple.developer.usernotifications.filtering entitlement on December 3rd, and have yet to receive a response from Apple. I understand that the holiday break may have gotten in the way, however it feels like we were lost in the queue as it's been 6 weeks with no response. Our app owner has checked-in inside appstoreconnect but has not received anything back.
Is this common? Is there any process for getting a status update?
Are we doing something wrong?
Without this entitlement we cannot make the device ring in the background. The app is a voice and video messaging platform.
Our application is designated to be used in a quite noisy environment (childcare facility) so we have implemented really annoying custom sounds. Unfortunately the system audio session playing custom sounds is apparently limited to half of the device volume possibility, even though the user sets full volume in the settings. How to change this behaviour to get louder notification sounds?
To be clear, I don't want to overcome user settings. If the user sets quieter volume or he sets the silent mode, the application should be silent too. I just need that 100% volume settings is actually 100% device volume.
This is a really critical feature for us and for our customers. We have already tried to ask for the critical alerts and we have been rejected.
Hi, I'm experiencing an issue with my app. I use Firebase as my server, and it is great. Still, there is one issue: when I send push notifications from my app to users, the users will get the notification if the app is open, but not when it is closed. I have tried many solutions to fix it, even asking AI, but the issue is still there. I would be happy to give you access to Firebase and the Xcode workspace, as I have no clue how to fix it.
Hello guys,
i need a little help. Im building an alarm clock app, pretty good one, and i have my own sounds i want to use as the alarm ring but notifications on apple cant work when the phone is turned off or the device is in silent mode (Or at least thats how i understand it) unless they have this feature called critical alerts that lets you have notifications even when the phone is turned off or silented. Without this, the phone can do just one beep and only when you open the notification, then it starts ringing but how is this supposed to wake you up? Alarmy has this worked out fine and i cant figure out how, maybe someone here knows. Im thinking maybe they have the critical alerts enabled but then i dont know why Apple would approve theirs and not mine. I tried to submit for the critical alerts feature but apple didn’t approve it saying the app is not the use case and im kinda lost. The whole app could be ruined because of this. So my question is. is there any way how i can use my custom sounds as a notifications on ios even if the phone is turned off or in silent mode+turned off and the app is not straight up running without being approved for critical alerts? Somehow like alarmy does it but i dont know if they have the critical alerts or not.
Thank you very much for any kind of help 🙏. For everyone whos reading this, take care!
Topic:
App & System Services
SubTopic:
Notifications
手机型号:iPhone 13 Pro
iOS版本号:iOS 18.6.2 (22G100)
用户开启了应用的系统通知功能,在收到离线推送后应用右上角展示未读消息数。在APP启动或者从后台恢复的时候,应用会用如下方法清理应用桌面图标的未读数角标。但是在部分机型上,应用转为“后台模式”时仍然会出现一个未读角标,且每次都是一个固定值;如果直接kill进程就不会出现未读角标。请问如何能够【完全】清理消息未读数,确保不会在退后台的时候再次出现呢?
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
if (@available(iOS 16.0, *)) {
[[UNUserNotificationCenter currentNotificationCenter] setBadgeCount:0 withCompletionHandler:nil];
[[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests];
[[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests];
}
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
content.badge = @(-1);
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"clearBadge"
content:content
trigger:nil];
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request
withCompletionHandler:^(NSError * _Nullable error) {
// Do nothing
}];
Topic:
App & System Services
SubTopic:
Notifications
I have been fighting this problem for two months and would love any help, advice or tips. Should I file a DTS ticket?
Summary
We attach a JPEG image to a local notification using UNNotificationAttachment. iOS reports the delivered notification as having attachments=1, but intermittently no image preview appears in Notification Center. In correlated cases, the attachment’s UNNotificationAttachment.url (which points into iOS’s attachment store) becomes unreadable (Data(contentsOf:) fails) even though the delivered notification still reports attachments=1.
This document describes the investigation, evidence, and mitigations attempted.
Product / Component
UserNotifications framework
UNNotificationAttachment rendering in Notification UI (Notification Center / banner / expanded preview)
Environment
App: OnThisDay (SwiftUI, Swift 6)
Notifications: local notifications scheduled with UNCalendarNotificationTrigger(repeats: false)
Attachment: JPEG generated from PhotoKit (PHImageManager.requestImage) and written to app temp directory, then passed into UNNotificationAttachment.
Test contexts:
Debug builds (direct Xcode install)
TestFlight builds (production signing)
iOS devices: multiple, reproducible with long runs and user clearing delivered notifications
Expected Result
Delivered notifications with UNNotificationAttachment should consistently show the image preview in Notification Center (thumbnail and expanded preview), as long as the notification reports attachments=1.
If the OS reports attachments=1, the attachment’s store URL should remain valid/readable for the lifetime of the delivered notification still present in Notification Center.
Actual Result
Intermittently:
Notification Center shows no image preview even though the app scheduled the notification with an attachment and iOS reports the delivered notification as having attachments=1.
When we inspect delivered notifications via UNUserNotificationCenter.getDeliveredNotifications, the delivered notification’s request.content.attachments.first?.url exists but is unreadable (attempting Data(contentsOf:) returns nil / throws), i.e. the backing attachment-store file appears missing or inaccessible.
In some scenarios the attachment-store file is readable for hours while the notification is pending, and then becomes unreadable after the notification is delivered.
Reproduction Scenarios (Observed)
Next-day reminders show attachment-store unreadable after delivery
1. Schedule a one-shot daily reminder for next day (07:00 local time) with UNCalendarNotificationTrigger(repeats: false) and a JPEG attachment.
2. During the prior day, periodic background refresh tasks verify the pending notification’s attachment-store URL is readable (pendingReadable=true).
3. After the reminder is delivered the next morning, the delivered snapshot shows the delivered notification’s attachment-store URL is unreadable (readable=false) and Notification Center shows no preview.
Interpretation: the attachment-store blob appears to become inaccessible around/after delivery, despite being readable while pending.
Evidence and Instrumentation
We added non-crashing diagnostic logging (Debug builds) around:
Scheduling time
Logged that we successfully created a UNNotificationAttachment from a unique temp file.
Logged that UNUserNotificationCenter.add(request) succeeded.
Queried pendingNotificationRequests() and logged the scheduled request’s attachment url.lastPathComponent (iOS attachment-store filename).
Delivered time (when app becomes active)
Called UNUserNotificationCenter.getDeliveredNotifications and logged:
delivered count, attachment count
attachment url.lastPathComponent
whether Data(contentsOf: attachment.url) succeeds (readable=true/false)
Content fingerprinting
Fingerprinted the exact JPEG bytes we wrote (SHA-256 prefix + byte count).
Logged the iOS attachment-store filename (url.lastPathComponent) returned post-scheduling.
Decode validation probe (later addition)
When Data(contentsOf:) succeeds, we validate it decodes as an image using CGImageSourceCreateWithData and log:
UTI (e.g. public.jpeg)
pixel width/height
magic header bytes
What we tried / Mitigations
Proactive “self-heal” for pending notifications
Change: during background refresh/foreground refresh, verify the pending daily reminder’s attachment-store URL readability. If it’s unreadable, reschedule with a new attachment (same trigger).
Rationale: if iOS drops the store file before delivery, recreating could repair it.
Result: We observed cases where pending remained readable but delivered became unreadable after delivery, so this doesn’t address all observed failures. It is still valuable hardening.
Increase scheduling frequency / reschedule closer to fire time (proposed/considered)
We discussed adding a debug mode to always recreate the daily reminder during background refresh tasks (or only within N hours of fire time) to reduce the time window between attachment creation and delivery.
Status: experimental; not yet confirmed to resolve the “pendingReadable=true → delivered unreadable after delivery” failure.
Impact
The primary UX value of the daily reminder is the preview photo; missing previews degrade core functionality.
Failures are intermittent and appear dependent on OS attachment-store behavior and Notification Center actions (clearing notifications), making them difficult to mitigate fully app-side.
Notes / Questions for Apple
1. Is iOS allowed to coalesce/deduplicate UNNotificationAttachment storage across notifications? If so, what is the retention model when delivered notifications are removed?
2. If a delivered notification still reports attachments=1, should its attachment-store URL remain valid/readable while the notification is still present in Notification Center?
3. In “next-day” one-shot scheduling scenarios, can the attachment-store blob be purged between scheduling and delivery (or immediately after delivery) even if the notification remains visible?
4. Is there a recommended pattern to ensure attachment previews remain stable for long-lived scheduled notifications (hours to a day), especially when using UNCalendarNotificationTrigger(repeats: false)?
Minimal Code Pattern (simplified)
1. Generate JPEG (PhotoKit → UIImage → JPEG Data).
2. Write to a unique temp URL.
3. Create attachment:
UNNotificationAttachment(identifier: <uuid>, url: <tempURL>, options: [UNNotificationAttachmentOptionsTypeHintKey: "public.jpeg"])
4. Schedule notification with a calendar trigger for the next morning.
Topic:
App & System Services
SubTopic:
Notifications