Post

Replies

Boosts

Views

Activity

Reply to Screen Time for your self
i don't know if this will help you but i built an app that present the FamilyActivityPicker and run it on the child device the familyActivityPicker in my app shows the apps installed on the device and after selecting one app only i used these lines of code:      if(self.mySelection.applications.count == 0 ) {       store.shield.applications = nil     } else {       store.shield.applications = self.mySelection.applicationTokens     } by clicking a button and the app was blocked on the child device so maybe the solution for self regulation is set yourself as a child on a family. hope i helped!
Jul ’21
Reply to Is the Screen Time API completely broken in the betas?
i have created an extension and changed the identifier to com.apple.deviceactivity.monitor-extension i subclassed DeviceActivityMonitor in my class and designated it as the principal class of my app extension but non of the methods doesn't get called when trying to monitor an activity what method will trigger the extension? is it center.startMonitoring(activity, during: schedule) in that case why non of my extension DeviceActivityMonitor methods doesn't gets called? why calling requestAuthorization on parent device always fails? can anyone upload some sample code that actually do something?
Aug ’21
Reply to Screen Time Guardian App Questions
if you set the family correctly the app that the child have should be presented on the picker on the parent i have a parent with iOS 15.0.2 and a child with iOS 15.1 and it seems to work (sort of) i have to mentioned that the facebook app is an app i downloaded after using the screen time api on my app and this require a confirmation from the parent app i did not managed to block or shield an app from the parent on the child because an authorization error i'm keep getting i don't know why the icon of the app is missing on the child app child: parent:
Nov ’21
Reply to How does child can unblock apps for some period of time using Screen Time API?
what your code actually says is: after 30 seconds of total usage of the application that you selected (applications.applicationTokens) the "eventDidReachThreshold" of the DeviceActivityMonitor extension will be called. handle your event ".encouraged" inside the "eventDidReachThreshold" and do there what ever you like. i think for you case if you want to limit some apps for a period of time just make a scheduled event that start from the current time you tapped an OK button (or some other action) to current time + limitation time of tour choice. and on your DeviceActivityMonitor extension you should handle the blocking and unblocking on the intervalDidStart and intervalDidEnd the your code should look something like this:   do {       let schedule = DeviceActivitySchedule(intervalStart: start, intervalEnd: end, repeats: false, warningTime: nil)            try center.startMonitoring(.block, during: schedule)           } catch {       print("error: " + error.localizedDescription)     }
Jan ’22
Reply to FamilyControls DeviceActivityMonitor extension can't change shields
."But even if I try only setting the restricted apps to nil or the empty set the apps remain shielded until I run the same code from the main app." - you need to remember that app and an app extension doesn't share data so it's likely that the store instance you are using isn't the same. what you need to do is to manage the selected apps list you want to shield or block using user defaults or core data or some other persistence storage that will be shared between your app and app extension. and block or unblock according to the data you are managing between them. try to keep the blocking or unblocking on the app or on the app extension so only one of the will use the store. i chose to do this on the extension using the events that correspond with start and stop monitoring
Jan ’22