Skip to content
PebblecraftPebblecraft
Say helloMenu
PebblecraftPebblecraft
Say hello

AlarmKit in production

Pebblecraft · Updated 4 November 2026

Dawnmates is a wake-up alarm that friends share. Each person's alarm is a real AlarmKit alarm on their own iPhone, and the app needs iOS 26. This note is about the choices we made around AlarmKit and the bugs we found in our own code. It ends with what we still don't know.

One thing up front

We have not measured late or silent alarms on our users' phones. Where this note talks about AlarmKit misbehaving, it links to public reports from other developers, and says so.

1. One repeating alarm

Each person's plan becomes a single AlarmKit alarm with a .weekly(days) relative schedule, not one alarm per day. It is the smallest thing we can ask the system to keep, and it means there is only one alarm to reconcile on launch. It also keeps us away from a pattern others report trouble with: several alarms fanned out over a short window firing late or not at all on iOS 26.5 (thread 825427).

This is roughly the whole configuration:

let alert: AlarmPresentation.Alert
if #available(iOS 26.1, *) {
    alert = AlarmPresentation.Alert(title: title, secondaryButton: snooze,
                                    secondaryButtonBehavior: .countdown)
} else {
    alert = AlarmPresentation.Alert(title: title, stopButton: stop,
                                    secondaryButton: snooze,
                                    secondaryButtonBehavior: .countdown)
}
let attributes = AlarmAttributes(
    presentation: AlarmPresentation(alert: alert,
                                    countdown: .init(title: "Snoozing")),
    metadata: DawnAlarmMetadata(crewName: crewName),
    tintColor: tint)

return AlarmManager.AlarmConfiguration(
    countdownDuration: .init(preAlert: nil, postAlert: snoozeSeconds),
    schedule: .relative(.init(time: time, repeats: .weekly(days))),
    attributes: attributes,
    stopIntent: AlarmStopIntent(alarmID: id),
    secondaryIntent: SnoozeIntent(alarmID: id),
    sound: sound)

One practical detail: AlarmManager isn't safe to share across threads, so our scheduler is main-actor bound and makes AlarmKit's async calls (requestAuthorization, schedule) from nonisolated static functions on AlarmManager.shared.

2. Never touch a ringing alarm

Our scheduler reconciles the plan with the system on every launch and background wake. The first version rescheduled more often than it needed to, and opening the app while the alarm was ringing or snoozed could disturb it. The fix has three parts:

  • We store a signature of what the alarm was built from (time, days, sound, label) and only reschedule when it changes, or when the alarm has gone missing from manager.alarms.
  • An alarm in .alerting or .countdown is left alone as long as it still matches the plan. If the person switched it off or moved it while it was ringing, we stop(id:) and cancel it for good, instead of letting it ring on.
  • Launch reads the last known “is an alarm scheduled” state from UserDefaults instead of waiting on the system's alarm list; the first reconcile checks it for real.

We listen to alarmUpdates to learn when an alarm starts ringing, is snoozed or stops, and compare each alarm's state with the last one we saw to turn the stream into events.

3. Three permission states

Our first version treated “not asked yet” as allowed: the check was authorizationState != .denied. The home screen then promised an alarm in seven hours when no system alarm existed. A pre-launch audit caught it. We now model the three states separately, and nothing claims to ring until the system has said yes:

var alarmPermission: AlarmPermission {
    switch manager.authorizationState {
    case .authorized: .allowed
    case .denied: .denied
    case .notDetermined: .notAsked
    @unknown default: .notAsked
    }
}

// requestAuthorization() can throw. No answer at all means
// alarms can't run here (an iPhone app on a Mac, or a restricted phone).
guard let state = try? await AlarmManager.shared.requestAuthorization() else {
    alarmUnavailable = true
    return false
}

The “no answer at all” case matters because AlarmKit isn't available to iPhone apps running on Apple silicon Macs. The app shows a plain message for each state (can't ring on this device, not turned on yet, not allowed, not set yet), with a button to Settings where that helps. The usage string, NSAlarmKitUsageDescription, is shown once at the end of setup.

4. Backup notifications

Other developers have reported AlarmKit alarms firing minutes late, or only when the phone is woken, on locked iOS 26 devices (thread 846063), and alarms set on 26.1 that stopped ringing after the 26.2 beta 3 update (thread 809398). In the threads we read, we found no confirmed fix in any iOS 26 release. We haven't reproduced these ourselves, but a wake-up app can't wait to find out, so we built a second line:

  • Each morning, a few Time Sensitive local notifications follow the alarm, by default at +1, +3 and +6 minutes. They play a short cut of the person's own alarm sound.
  • They are dated, one-off UNCalendarNotificationTriggers (repeats: false), written for the next ten days, so checking in can cancel this morning's without touching next week's. Their identifiers carry the day, and check-in removes pending and delivered ones with that prefix.
  • iOS keeps at most 64 pending notifications per app, so we cap ours at 48 and top them up on every launch, check-in and background refresh. A signature skips the rewrite when nothing changed.
  • The phone's time zone is part of that signature: the same wall-clock time is a different moment after a flight.
  • If the person hasn't allowed alarms, the series starts at the alarm time itself, so a notification at least arrives on time.

The limit is plain, and we say it to users in the app, on our site and in the store listing: unlike the alarm, notifications follow the silent switch and Focus. They are a backup, not a second alarm.

5. Stopping isn't checking in

In Dawnmates, friends see when you check in, so silencing the alarm mustn't count as getting up. Our stopIntent stops the alarm, records that it stopped, and has openAppWhenRun = true, so the app opens on the check-in screen. The backups keep coming until the person checks in.

The check-in button itself lives in the alarm's Live Activity, which AlarmKit runs while the alarm rings or is snoozed. Our widget extension declares an ActivityConfiguration for AlarmAttributes<DawnAlarmMetadata>, with “I'm up” and Snooze buttons on the Lock Screen and in the Dynamic Island. All three intents (check-in, stop, snooze) are LiveActivityIntents compiled into both the app and the extension; the system runs them in the app, where we set the handler at launch.

6. iOS 26.1 changed the alert

On iOS 26.0, AlarmPresentation.Alert takes a custom stop button. From 26.1, that initialiser is deprecated with the message “stopButton is deprecated and will no longer be used”, and a new one takes only the title and the secondary button. The system draws its own stop control. We branch with #available(iOS 26.1, *), as in the configuration above.

The practical effect: you get one button of your own on the alert. Ours is Snooze, with .countdown behaviour and a postAlert duration equal to the person's snooze length. Anything else, like checking in, has to live in the Live Activity or a notification.

7. Snooze with no limit

The countdown button can be pressed as often as the person likes, and the system re-rings each time. Our server only counts three snoozes a morning, so for a while the phone and the crew disagreed. Every snooze we control (the in-app screen, the backup notifications, the Watch, the Lock Screen) now stops offering Snooze after the third: backups lose the button, and a late press in the app is refused with a note. The alarm's own button can't be taken away, so a press there still counts.

8. Custom sounds

Apple's documentation says an alarm sound can live in the main bundle or in Library/Sounds. In practice, developers have reported Library/Sounds not working, and an Apple engineer called it a known issue in September 2025 (thread 801530); we couldn't find a confirmed fix version. So every sound Dawnmates sells ships in the app bundle, and a new sound pack rides an app update.

What we do with them:

  • We pass the full file name with its extension to AlertSound.named(_:). One report on iOS 26.5 says the default sound plays without it (thread 836432).
  • Files stay under 30 seconds (ours are about 26), following an Apple engineer's answer in thread 797172.
  • They are mono CAF files in IMA4, which cut them to about a quarter of their 16-bit PCM size: one went from 2.3 MB to 613 KB.
  • The alarm must never point at a file that might be missing, or a pack the person no longer owns after a refund. The plan's sound is resolved first; if its file isn't there we fall back to a free bundled sound, and only then to the system default.
for candidate in [name, "Horizon"] {
    let file = candidate.lowercased().replacingOccurrences(of: " ", with: "-")
    for ext in ["caf", "m4a", "wav"]
        where Bundle.main.url(forResource: file, withExtension: ext) != nil {
        return .named("\(file).\(ext)")   // the full file name, extension included
    }
}
return .default

Reports on looping disagree: an Apple engineer wrote that looping isn't supported for custom sounds, and later replies say a sound loops when the alarm is scheduled from the main app. We schedule from the app target, but we haven't settled this on a device ourselves.

9. Testing

In the simulator, AlarmKit alerts don't fire on the lock screen since iOS 26.1. Apple DTS confirmed it and suggested a physical device (thread 806998). The fan-out thread above also says the simulator doesn't show that problem. So the simulator can't tell you whether an alarm will ring.

Everything that talks to the phone sits behind a small AlarmScheduler protocol: permission, apply a plan, check in, snooze, cancel, and a stream of ringing, snoozed and stopped events. Unit tests and our screenshot runs use a fake. The rules for when backups fire live in a plain struct with no system calls, so they are tested without a phone. The real proof, whether an alarm rings on time on a locked phone overnight, only a real phone can give.

What we still don't know

  • Whether custom sounds loop on current iOS 26 releases, from the app target, across a reboot.
  • Whether Library/Sounds works now, which would let sound packs arrive without an update.
  • Whether IMA4 files behave exactly like PCM ones in AlarmKit on every 26.x release.
  • How often the late or missed alarms others report happen on our users' phones. We have no numbers for it.

If you have answers, or you think something here is wrong, we'd be glad to hear it: support@pebblecraft.app. We will update this page.

Sources

PebblecraftFour apps, two games

Say hello