"I need an iOS meditation timer where the screen dims naturally but bells play at scheduled intervals when the screen is locked. AVAudioSession .playback prevents dimming. Without it, bells don't play when locked. How do apps like Plum Village achieve both simultaneously?"
Thanks for taking the time to share your question here.
Please provide more details. Expanding on your post to include any error messages, code snippets, steps you've already taken to troubleshoot, and the expected/actual outcomes would be very helpful. Including explaining what's the Plum Village? Is that another app in the Store you trying to reproduce?
I'm sure someone in the community will be able to help once you have a chance to update your post.
If you post is about using the class Timer on your app. Because iOS suspends apps shortly after the screen locks, your internal Timer or DispatchQueue will freeze unless the app is kept alive. Have you look at AlarmKit?
If you do not want to keep your app alive in the background, which drains slightly more battery, you can schedule Local Notifications?
Looking forward to your reply.
Albert WWDR
I did a quick search and it says that those other apps you mentioned are likely playing sound the whole time in order to prevent the OS from suspending the app. It's called playing silent audio so that the system lets the app continue running and counting the timer.