Post

Replies

Boosts

Views

Activity

AlarmKit — stop automatically at the end of a custom sound while the app is suspended
We are building a scheduled-audio app. We need a complete custom recording to start at a scheduled time while the device is locked, play exactly once, and stop automatically without user interaction. The app may be suspended at the scheduled time. Environment: iPhone 11, iOS 26.6.1; Xcode 26.6 with iOS 26.5 SDK; deployment target iOS 26.1. The app was signed for development, installed, and launched without an attached debugger. Alarm authorization was granted. No background audio mode or countdown Live Activity is configured. We bundle a 154.017959-second, mono 44.1 kHz 16-bit PCM CAF in the main bundle. The recording was converted to CAF without trimming. Minimal scheduling code, called after successful authorization (using the generic example filename sample-sound.caf): import ActivityKit import AlarmKit import SwiftUI struct PlaybackMetadata: AlarmMetadata {} @MainActor func schedulePlaybackTest() async throws { let attributes = AlarmAttributes( presentation: AlarmPresentation( alert: .init(title: "Audio playback test") ), metadata: PlaybackMetadata(), tintColor: Color.teal ) let configuration = AlarmManager.AlarmConfiguration.alarm( schedule: .fixed(Date().addingTimeInterval(60)), attributes: attributes, sound: .named("sample-sound.caf") ) _ = try await AlarmManager.shared.schedule(id: UUID(), configuration: configuration) }NSAlarmKitUsageDescription is present in the built Info.plist. Reproduction: schedule, lock the phone before the fire date, then leave it locked and listen through the end. The recording starts automatically and plays completely, but then repeats. This is a single fixed alarm, not a repeating schedule. Questions: Is there a supported public configuration for playing a custom AlarmKit sound once and dismissing/stopping the alarm at end of file? If not, is there an OS-managed maximum alert duration, scheduled stop, or guaranteed callback that can meet this requirement when the app is suspended or terminated? Is unattended play-once-and-stop unsupported with the current public APIs, so that this should be filed as an enhancement request? We understand that postAlert describes a subsequent countdown, and that stop(id:) can be called by executing app code. A foreground timer or a user-triggered stop intent would not meet the requirement. We want an intended public API solution appropriate for App Store distribution.
0
0
14
1d
AlarmKit — stop automatically at the end of a custom sound while the app is suspended
We are building a scheduled-audio app. We need a complete custom recording to start at a scheduled time while the device is locked, play exactly once, and stop automatically without user interaction. The app may be suspended at the scheduled time. Environment: iPhone 11, iOS 26.6.1; Xcode 26.6 with iOS 26.5 SDK; deployment target iOS 26.1. The app was signed for development, installed, and launched without an attached debugger. Alarm authorization was granted. No background audio mode or countdown Live Activity is configured. We bundle a 154.017959-second, mono 44.1 kHz 16-bit PCM CAF in the main bundle. The recording was converted to CAF without trimming. Minimal scheduling code, called after successful authorization (using the generic example filename sample-sound.caf): import ActivityKit import AlarmKit import SwiftUI struct PlaybackMetadata: AlarmMetadata {} @MainActor func schedulePlaybackTest() async throws { let attributes = AlarmAttributes( presentation: AlarmPresentation( alert: .init(title: "Audio playback test") ), metadata: PlaybackMetadata(), tintColor: Color.teal ) let configuration = AlarmManager.AlarmConfiguration.alarm( schedule: .fixed(Date().addingTimeInterval(60)), attributes: attributes, sound: .named("sample-sound.caf") ) _ = try await AlarmManager.shared.schedule(id: UUID(), configuration: configuration) }NSAlarmKitUsageDescription is present in the built Info.plist. Reproduction: schedule, lock the phone before the fire date, then leave it locked and listen through the end. The recording starts automatically and plays completely, but then repeats. This is a single fixed alarm, not a repeating schedule. Questions: Is there a supported public configuration for playing a custom AlarmKit sound once and dismissing/stopping the alarm at end of file? If not, is there an OS-managed maximum alert duration, scheduled stop, or guaranteed callback that can meet this requirement when the app is suspended or terminated? Is unattended play-once-and-stop unsupported with the current public APIs, so that this should be filed as an enhancement request? We understand that postAlert describes a subsequent countdown, and that stop(id:) can be called by executing app code. A foreground timer or a user-triggered stop intent would not meet the requirement. We want an intended public API solution appropriate for App Store distribution.
Replies
0
Boosts
0
Views
14
Activity
1d