Search results for

DeviceActivityMonitor

127 results found

Post

Replies

Boosts

Views

Activity

FamilyControls Entitlement Not Working for External TestFlight Testers
Hi all, I’ve run into a frustrating issue with the FamilyControls and DeviceActivityMonitor APIs. I’ve received official approval from Apple to use the com.apple.developer.family-controls entitlement (distribution), and I’ve added the entitlement to both my main app and the DeviceActivityMonitor extension. I’ve also ensured the correct App Group is configured for both targets. Everything works perfectly when I install the app on my own device as an internal TestFlight tester. App blocking works, the DeviceActivityMonitor extension runs as expected, and the apps selected by the user are correctly shielded. However, for external TestFlight testers, while they do receive the Screen Time permission prompt, and can select apps to block, nothing actually gets blocked. It appears that the DeviceActivityMonitor extension is not being triggered at all on their devices. I’ve verified the following: The entitlement is approved and visible in App Store Connect The build is approved for
2
0
146
Apr ’25
Reply to The DeviceActivityMonitor did not trigger a callback
Below is all the code; the method intervalDidStart has never been called. Can you help me? import UIKit import MobileCoreServices import ManagedSettings import DeviceActivity class MyMonitor: DeviceActivityMonitor { let store = ManagedSettingsStore() override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) print(interval did start) let model = MyModel.shared let applications = model.selectionToDiscourage.applicationTokens store.shield.applications = applications.isEmpty ? nil : applications store.appStore.maximumRating = 200 } override func intervalDidEnd(for activity: DeviceActivityName) { super.intervalDidEnd(for: activity) store.shield.applications = nil store.clearAllSettings() } } // // MyModel.swift // FamilyCotrol // // Created by mac on 2024/6/24. // import UIKit import Foundation import FamilyControls import DeviceActivity import ManagedSettings class MyModel: ObservableObject { static let shared = MyModel() let store = ManagedSettingsStore() p
Topic: App & System Services SubTopic: General Tags:
Jun ’24
App Shielding unexpectedly active outside of schedule
I'm using the Screen Time API to shield apps the user selects. The problem is, that the apps are always shielded, even outside of the schedule. Here is my function initiateMonitoring: func initiateMonitoring(scheduleStart: DateComponents, scheduleEnd: DateComponents) { let schedule = DeviceActivitySchedule( intervalStart: scheduleStart, intervalEnd: scheduleEnd, repeats: true ) let center = DeviceActivityCenter() do { try center.startMonitoring(.daily, during: schedule) logger.log(STARTED MONITORING) } catch { logger.log(FAILED MONITORING: (error.localizedDescription)) } } The expected result should be that the selected Apps should be blocked during the schedule the user specified, but not outside the schedule, but it is blocked 24/7. I've experimented with the DateComponents, but the issue may be somewhere else. What's maybe interesting is, I tried Logging the DeviceActivityMonitor and somehow it doesn't get called. The logging-output from initiateMonitoring is printed in the console, but for the DeviceActivityMonitor
1
0
829
Mar ’24
Irrecoverable Crash in Extension
We are seeing cases where DeviceActivityMonitoring extension is crashing permanently. This is due to a now-fixed bug that was causing a stack overflow. On devices where the extension crashed, it appears permanently unable to recover - even weeks after the crash and after multiple restarts of the device. It looks like recovery is being attempted, as the same four NSLog activities are emitted roughly every second that the phone is active. Logs: Process: DeviceActivityMonitoring Activity: beginning extension request Message: NSExtensionPrincipalClass `` does not conform to NSExtensionRequestHandling protocol! Process: DeviceActivityMonitoring Activity: Loading Preferences From User Session CFPrefsD Message: Process: DeviceActivityMonitoring Activity: container_system_group_path_for_identifier Message: Requesting container lookup; class = 13, identifier = , group_identifier = , create = 1, temp = 0, euid = 501, uid = 501 container_query_get_single_result: success container_syst
1
0
954
Aug ’23
DeviceActivityCenter stops monitoring if another Screen Time app starts monitoring during the same schedule
I've downloaded another screen time app that uses DeviceActivityMonitor, and once that app starts monitoring during an active monitoring schedule on my app - my app's monitoring schedule immediately ends. Is this expected behavior? Can't find this in any of the docs, but are two separate apps allowed to monitor activities during an overlapping schedule?
1
0
854
Feb ’23
Selection To Discourage
i'm trying to make my app start blocking/shielding and app according to the selection from a familyActivityPicker. the problem that i'm having is that MyModel object is always nil when i'm accessing it inside the app extension. (DeviceActivityMonitor). can someone give me an example of the object he uses to get the applicationTokens in the app extension? an explanation on how to transfer information between the app and the app extension is also welcome.
1
0
1.3k
Oct ’21
Inconsistency in the DeviceActivityEvent callbacks
We are using the Apple ScreenTime API for monitoring the usage of device. As mentioned in the documentation (https://developer.apple.com/documentation/familycontrols), we are getting the family controls authorisation from the user. We also have added the ‘DeviceActivityMonitor’ app extension (https://developer.apple.com/documentation/deviceactivity/deviceactivitymonitor) to receive the schedule and event callbacks. We have a requirement in which we have to notify the user for every 15 minutes usage of the device in the specified interval. He can optionally select individual categories or applications for the 15 minutes notification. For monitoring the usage for individual categories or applications, we obtain the token by presenting the FamilyActivityPicker as discussed in this documentation https://developer.apple.com/documentation/familycontrols/familyactivitypicker. For simplicity in testing during the development phase, we reduced the 15 minutes to 2 minutes. The events callbacks are exp
3
0
959
Jun ’24
Device Activity Extension not being called
Hi all, I am facing a problem following the code in the Meet the Screen Time API video. I've tried scheduling the monitoring time from 00:00 to 25:59 or some other time but functions in DeviceActivityMonitor are never being called. I tried to print log from those functions, nothing shown. Is there any settings I've missed? In addition, I already changed the NSExtensionPrincipalClass value to my class name. Any help would be appreciated!
2
0
2.3k
May ’22
Best way to pause DeviceActivitySchedule
Hi everyone, I'm currently working with the Screen Time API, specifically trying to figure out the best way to pause an active, repeating schedule without disrupting future schedules. Here's the scenario: I have a repeating schedule set from 10:00 AM to 8:00 PM daily. If I need to pause the schedule temporarily, my current approach involves stopping monitoring, clearing all restrictions, and then setting a new schedule for the remaining time after the pause. However, this method cancels the repeating schedule entirely, which causes issues when the schedule is supposed to restart the next day at 10:00 AM. Instead, it starts after the pause time, which isn’t what I want. Challenges I'm Facing: Maintaining Repeating Schedules: How can I pause the schedule in a way that ensures it resumes correctly the next day at the intended time (10:00 AM)? DeviceActivityMonitor Logic: Is there a way to deactivate and reactivate the schedule through the DeviceActivityMonitor without fully stopping the monitor
1
0
916
Aug ’24
Screen Time API, DeviceActivity, Family Controls, Entitlements, Provisioning Profile
Hello everyone, I'm hoping to find a solution for a critical issue that is blocking my app's submission to the App Store. My app uses the Screen Time API and therefore has a main app and a DeviceActivityMonitor extension. The main app has been successfully granted the Family Controls (Distribution) entitlement. However, the DeviceActivityMonitor extension is stuck with only the Family Controls (Development) entitlement. This mismatch causes my build to fail during the archive/distribution process with the error: Provisioning profile failed qualification. Profile doesn't support Family Controls (Development). This is a hard blocker, as the extension is a mandatory part of the API. I have already filled out the entitlement request form and also contacted Developer Support (Case #102666581576), who confirmed they could not assist and directed me here. My question is: What is the correct procedure to escalate or resolve the issue of a required extension not receiving the distribution-level Famil
1
0
301
Aug ’25
Module 'DeviceActivity' not found
I have a class that uses DeviceActivityMonitor as a subclass: // MyMonitor.swift import DeviceActivity @objc(MyMonitor) class MyMonitor: DeviceActivityMonitor { ... } In order to use SwiftUI in Objective-C, I'm importing this in my objective-c file #import MyProject-Swift.h. But, when I try to build, I get the error Module 'DeviceActivity' not found from wthin #import MyProject-Swift.h I've tried Link Binary with Libraries: I've also tried to turn on Define Modules in Build Settings -> Packaging. It just seems as though the DeviceActivity framework doesn't have a header file. Seems like it should? When I click Show in Finder in MyProject -> Frameworks -> DeviceAcitivity.framework, there is not DeviceActivity.h file in that dir (also not in the modules folder in my screenshot): Is there a way to create a header file for an apple framework? Or force the creation of one? I have also tried cleaning the build folder Here's the framework for reference: https://developer.apple.com/document
6
0
1.7k
Dec ’22
Core Data not returning results in ShieldConfiguration Extension, but works fine in other extensions
Hi everyone, I’m using Core Data in several extensions (DeviceActivityMonitor, ShieldAction, and ShieldConfiguration). It works perfectly in DeviceActivityMonitor and ShieldAction. I’m able to successfully fetch data and log the correct count using a fetch request. However, when I try the same setup in the ShieldConfiguration extension, the fetch request always returns 0 results. The CoreData and App Group setup appears to be correct since the first two extensions fetch the expected data. I’ve also previously tested storing the CoreData objects separately in a JSON-FIle using FileManager and it worked without issues—though I’d prefer not to handle manual encoding/decoding if possible. The documentation mentions that the extension runs in a sandbox, restricting network requests or moving sensitive content. But shouldn’t reading data (from a shared App Group, for instance) still be possible within the sandbox, as it is the case with the Files, what is the difference there? In my case, I only n
2
0
1k
Oct ’24
Monitor DeviceActivityEvent for all categories: ActivityCategoryPolicy.all? Without using FamilyActivityPicker
Using ManagedSettings I'm able to shield all categories of applications using ActivityCategoryPolicy.all , without the user using picking categories with the FamilyActivityPicker. I would like to create a DeviceActivityMonitor which monitors events for all (or a specific) categories of apps, without the user needing to interact with the FamilyActivityPicker. Is this possible? And an extra question: is there no way to pick a specific category to shield? Just like we are able to do with ActivityCategoryPolicy.all, instead something like: ActivityCategoryPolicy.games
0
0
1.1k
Feb ’23
Stuck waiting on Family Controls distribution entitlement, first indie app, looking for guidance/timelines
Hi everyone, solo iOS dev here. I’ve built a small focus app (“Modo”) that uses Apple’s Screen Time APIs to help curb social-media overuse. In development everything works: FamilyActivityPicker for selection, a DeviceActivityMonitor extension for schedules, and ManagedSettings shields (plus uninstall guard only while “Blocked” is active). I requested the Family Controls distribution entitlement so I can ship, but my capability request has been pending for a while and I’m not sure what the usual path forward is. What I’ve already done • Submitted the capability request (Account Holder), describing the use case (self-control / digital well-being), user consent flow,. • Implemented app + DeviceActivityMonitor + ManagedSettingsUI extensions; verified the debug build has the right entitlements and behavior. • Regenerated profiles after the request; checked codesign entitlements on the built targets. • Filed a Developer Support ticket referencing the capability request. I really appreciate any tim
1
0
250
Nov ’25