Apple's Screen Time API Broke Me
I spent 97 days building Habit Doom, an iOS app that locks your distracting apps until you complete your daily habits. The hardest part was not the UI, the business logic, or the App Store review p...
Source: dev.to
I spent 97 days building Habit Doom, an iOS app that locks your distracting apps until you complete your daily habits. The hardest part was not the UI, the business logic, or the App Store review process. It was Apple's Screen Time API. This is everything I learned: the stuff Apple's documentation does not tell you, the behaviors that will break your app silently, and the architecture I ended up with after 21 bugs nearly killed the project. If you are building anything that locks or monitors apps on iOS, this might save you weeks. The Three Frameworks Apple's "Screen Time API" is actually three separate frameworks that work together: FamilyControls handles authorization. Your app requests permission from the user to monitor and restrict their device activity. This is the gatekeeper. ManagedSettings handles the actual blocking. You create a ManagedSettingsStore and set store.shield.applications to a set of app tokens. Those apps are now locked at the OS level. Users see a shield screen