Managed Settings

RSS for tag

Set restrictions for certain settings, such as locking accounts in place, preventing password modification, filtering web traffic, and shielding apps.

Posts under Managed Settings tag

109 Posts
Sort by:
Post not yet marked as solved
0 Replies
733 Views
I am trying to understand how much I can do with shield actions, if anything. So at its basic, the shield action has 3 options, none, defer, and close. I believe defer is used to rebuild the shield if needed (for example, a parent allowing their child to open the app). Can this be used as a button to just straight up bypass the shield? Like if a user taps button one, it would run shield action close, if taps button two, it would bypass the shield and open the app? If so, how would one bypass since t he handler requires the shield action options? override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) { switch action { case .primaryButtonPressed: completionHandler(.close) case .secondaryButtonPressed: completionHandler(.defer) @unknown default: fatalError() } }
Posted
by
Post not yet marked as solved
0 Replies
1k Views
Can't find much right now, but maybe Apple devs can share some updates ;) Documentation: https://developer.apple.com/documentation/ManagedSettings?changes=latest_minor https://developer.apple.com/documentation/DeviceActivity?changes=latest_minor https://developer.apple.com/documentation/FamilyControls?changes=latest_minor Videos: https://developer.apple.com/wwdc23/sessions/?q=screen%20time
Posted
by
Post not yet marked as solved
4 Replies
870 Views
Hi, I'm new to the developer community and am developing an app for a school project that relies on the screentime API. I'm using SwiftUI to generate Labels using the given ApplicationToken generated from my FamilyActivitySelection. However, I notice that the icon for these tokens is extremely small: only about 25x25 px. I'm wondering if there is a way that the screentime API can let us use higher-res images using the opaque tokens? This would be extremely useful in developing a more HIG-aligned app (e.g. a scroll-view of blocked apps). Thank you!
Posted
by
Post not yet marked as solved
0 Replies
661 Views
Can someone please provide step-by-step instructions on how I can create an Apple TV configuration profile that will block access to the settings app without a password
Posted
by
Post not yet marked as solved
3 Replies
1.9k Views
A few days ago, I upgraded my phone to iOS 17 and have since encountered a serious issue with my app, which heavily uses the Screen Time API. Randomly throughout the day, the Screen Time connection breaks. As a result, all device activity reports turn up empty and the device activity center stops tracking activities. This problem doesn't only affect my app, but also all others that have Screen Time permissions on my phone. The only workaround I've found is to switch off and then switch on the Screen Time permission again. This issue is clearly a significant concern for all developers working with the Screen Time API. I've submitted a bug report (FB12332405), but I can't dig deeper into the problem because I'm stuck on this: https://developer.apple.com/forums/thread/731010. Has anyone else come across this issue since upgrading to iOS 17?
Posted
by
Post not yet marked as solved
0 Replies
792 Views
Whenever a user focuses a textfield inside the view provided a device activity report extension, the extension crashes in iOS 17 (21A5248v). This worked flawlessly in iOS 16. I've submitted a bug report (FB12270432), but I can't dig deeper into the problem because I'm stuck on this: https://developer.apple.com/forums/thread/731010. Has anyone else come across this issue since upgrading to iOS 17?
Posted
by
Post not yet marked as solved
0 Replies
578 Views
The Screen Time API allows developers to block / shield all apps that aren't in the user's "Always Allowed" list in the Screen Time settings (by setting .all() for ShieldSettings.ActivityCategoryPolicy. What I've found, though, is that if an app is blocked, the user can simply go to this Always Allowed list, add that app, and it immediately becomes unblocked. I am trying to either prevent a user from being able to do this or detect when a user does this, as the point of an app like mine (that allows the user to block other apps) is to prevent people from easily accessing those apps that are blocked. Is this possible?
Posted
by
Post not yet marked as solved
6 Replies
1.2k Views
Our app uses Cordova with a Cordova Local Webserver plugin. This plugin uses the url http://localhost: with a randomly chosen port. Some of the devices that our app runs on are MDM configured and have Content Filters enabled which only allows a finite list of website URLs to be accessed. This configuration has always worked in the past. Starting with the release of iPadOS 16.5, our app now hangs because the content filters are now preventing access to http://localhost. We've tried adding http://localhost, plus any derivative of that URL (i.e. http://localhost:, http://localhost:*, etc.) to the Allowed Website list, but this does not help. Wondering if anyone else has encountered this issue.
Posted
by
Post not yet marked as solved
0 Replies
479 Views
I am using Managed Settings to block all apps during a set period of time using the below method. override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) ManagedSettingsStore().shield.applicationCategories = .all() } When a user opens an app during that time, they should be allowed to press a button on the shield which lets them "continue using that app", just like the default iOS screen time allows for. However, this doesn't seem possible right now when the below delegate is called for ActivityCategoryToken ShieldAction: override func handle(action: ShieldAction, for category: ActivityCategoryToken, completionHandler: @escaping (ShieldActionResponse) -> Void) { switch action { case .primaryButtonPressed: completionHandler(.close) case .secondaryButtonPressed: ManagedSettingsStore().shield.applicationCategories = .all(except: category) //this is not possible right now. completionHandler(.none) @unknown default: fatalError() } } This is because the .all(except:) method takes a set of application tokens, but the handle delegate method on activityCategoryTokens only provides application category tokens. Is there no way to get around this? It would be very helpful if either a) the delegate method for ActivityCategoryToken ShieldAction also provided the ApplicationToken that was blocked (this would be preferred), or b) the .all(except: ) method also accepts ActivityCategoryTokens as an input.
Posted
by
Post not yet marked as solved
0 Replies
382 Views
Currently, FamilyActivity labels rendered with Label(ApplicationToken) seem to have no way to respect a .preferredColorscheme(.dark/.light). The token appearance seems coerced to the system setting rather than the app preference. This results in tokens being arbitrarily invisible according to combinations of app and system colorscheme preferences. For example, if the user has set dark mode and SwiftUI sets .preferredColorscheme(.light), both the view background and label text will be white. (Conversely, with a combination of system light mode and view .preferredColorscheme(.black), both the view background and label text is be black). Is there any way to get a Label(ApplicationToken) to respect the application's preferredColorScheme?
Posted
by
Post not yet marked as solved
0 Replies
338 Views
[Question] Are there any minimum and recommended hardware specifications (iPhone model) for Screen Time API to operate correctly ? I'm not sure but in my guess, when application's token created, Screen Time seems to use CryptoKit's functions which are based on a specific hardware encryption configuration not supporting all of the iPhone models. [Reproduction] FamilyActivityPicker shows the application list of the child device on the parent device remotely. Selects a few of child's applications from the FamilyActivityPicker View. Transfers the object of FamilyActivitySelection class, which contains the selected applications tokens, to the child device through CloudKit. Try to assign the selected application tokens to the shielding related variable of ManagedSettingsStore object on the child device by below statements. "let applications = newValue.applicationTokens store.shield.applications = applications.isEmpty ? nil : applications" [Result] Shows an error message like below and the selected applications have not been shielded "Unable to set shield.applications for store container com.XXXXX.TestScreentimeAPI and name Default: Error Domain=CryptoKit.CryptoKitError Code=3 "(null)" [Test devices] iPhone 13 Pro (iOS 16.5) for child iPhone SE2 (iOS 16.5) for parent [Additional explanation] In case of using below devices, the selected applications have been shielded successfully without showing any error message. iPhone 13 Pro (iOS 16.5) for child iPhone 11 Pro (iOS 16.5) for parent
Posted
by
Post not yet marked as solved
0 Replies
370 Views
We want to include Screen Time API access codes in not only main app (container app) but also app extension such like Location Push Service Extension or Widget Extension. On app extension side, are there any restrictions to create and use objects of below classes in either cases , main app is running or not running ? ManagedSettingsStore DeviceActivitySchedule DeviceActivityCenter and also, do they do the same thing that works on the main app side like below ? shield application create a device activity schedule startMonitoring
Posted
by
Post not yet marked as solved
0 Replies
586 Views
Does anyone know if there's a way to use the FamilyActivityPicker and select apps in the simulator? Right now, my app list is blank even after giving Screentime API permissions. Therefore, I have to do all testing on a physical device or in previews. Not sure if I'm missing something, this is a bug, or this should be a feedback assistant post.
Posted
by
Post not yet marked as solved
1 Replies
503 Views
Hello! I'm currently making an app that involves the Screen Time API. I have the required entitlements and capabilities added, both in Xcode and the developer portal, and I've requested, got, and enabled the Family Controls (Distribution) entitlement. I am using requestAuthorization(for: .individual) for the API. I'm encountering a problem with the shield settings within ManagedSettingsStore, I can't seem to have the store shield over 50 apps (app tokens) or 50 websites (web tokens). If I assign store.shield.applications or store.shield.webDomains with over 50 items each, then the store will not shield any items and calling these variables returns nil for both. I am using ManagedSettingsStore(named: _) and I have 12 ManagedSettingsStore.Name items in total. As long as there are 50 apps and/or 50 websites under any shield, or combined from multiple shields, then no other shields from other stores will be able to shield apps or websites. I can't seem to find information about this online, and I'm thinking that I'm likely using the API wrong. I encountered this both on iOS 16 and the iOS 17 betas, and Xcode 14.3+ and the Xcode 15 betas. (I did not start the project until Xcode 14.3 was released) Thanks.
Posted
by
Post not yet marked as solved
2 Replies
680 Views
I'm having trouble with my DeviceActivityMonitorExtension. The intervalDidStart function is not being called when the scheduler is created. Does anyone have an idea why this is? let schedule = DeviceActivitySchedule( intervalStart: DateComponents(hour: 15, minute: 23), intervalEnd: DateComponents(hour: 16, minute: 55), repeats: true ) class MySchedule { static public func setSchedule() { let center = DeviceActivityCenter() center.stopMonitoring([.daily]) do { try center.startMonitoring(.daily, during: schedule) } catch { print("Error monitoring schedule: ", error) } } } class DeviceActivityMonitorExtension: DeviceActivityMonitor { override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) SelectedApps.shared.setRestrictions() } private let _SelectedApps = SelectedApps() class SelectedApps: ObservableObject{ @Published var selection: FamilyActivitySelection let store = ManagedSettingsStore() init() { if let savedSelection = UserDefaults.standard.object(forKey: "savedSelection") as? Data { let decoder = JSONDecoder() if let loadedSelection = try? decoder.decode(FamilyActivitySelection.self, from: savedSelection) { selection = loadedSelection } else { selection = FamilyActivitySelection(includeEntireCategory: true) } } else { selection = FamilyActivitySelection(includeEntireCategory: true) } } class var shared: SelectedApps { return _SelectedApps } func setRestrictions(){ let applications = selection store.shield.applications = applications.applicationTokens.isEmpty ? nil : applications.applicationTokens store.shield.applicationCategories = applications.categoryTokens.isEmpty ? nil : ShieldSettings.ActivityCategoryPolicy.specific(applications.categoryTokens) }
Posted
by
Post marked as solved
3 Replies
678 Views
I am creating a custom shield UI for when an app is blocked. have an AppDelegate file where my @UIApplicationMain is run I pasted in the ShieldConfiguration code from the WWDC21 Meet Screen Time demo inside my app: class MyShieldConfiguration: ShieldConfigurationDataSource { override func configuration(shielding application: Application) -> ShieldConfiguration { return ShieldConfiguration( title: ShieldConfiguration.Label(text: "Doxo", color: UIColor.blue), subtitle: ShieldConfiguration.Label(text: "heyhey") ) } } but after calling store.shield.applications = .... the default restricted screen is being shown instead of the one I configured above Where am I supposed to put MyShieldConfiguration ?
Posted
by
Post not yet marked as solved
1 Replies
629 Views
I added the extension via targets. And I added code in the intervalDidStart() override to print and send a notification. But it never seems to run. Am I supposed to do any other steps after adding the extension? // Make sure that your class name matches the NSExtensionPrincipalClass in your Info.plist. class DeviceActivityMonitorExtension: DeviceActivityMonitor { func getSelectionFromUserDefaults() -> FamilyActivitySelection { let defaults = UserDefaults.standard if let encodedData = defaults.data(forKey: "ScreenTimeSelection") { let decoder = PropertyListDecoder() if let selection = try? decoder.decode(FamilyActivitySelection.self, from: encodedData) { return selection } } return FamilyActivitySelection() } override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) print("HERE!") let content = UNMutableNotificationContent() content.title = "Feed the cat" content.subtitle = "It looks hungry" content.sound = UNNotificationSound.default // show this notification five seconds from now let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) // choose a random identifier let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger) // add our notification request UNUserNotificationCenter.current().add(request) let selection = getSelectionFromUserDefaults() let applications = selection.applicationTokens let categories = selection.categoryTokens let webCategories = selection.webDomainTokens let store = ManagedSettingsStore() store.shield.applications = applications.isEmpty ? nil : applications store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set()) store.shield.webDomainCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set()) }
Posted
by
Post not yet marked as solved
1 Replies
377 Views
We created iPhone app for portrait mode only. App is running fine in iPhone. but when we run the same app in iPad some time we are getting rotation button along with scale button. Rotation button is rotating app in landscape and our app is not support so UI is look bad. We want to disable rotation button forever. We search for setting which can be used enable/disable this rotation button but did not found. Check attached screen shot for reference.
Posted
by
Post not yet marked as solved
1 Replies
523 Views
Say a user wants to restrict their schedule for a certain app's usage every day. For sake of example, lets say they want to block Fruit Ninja usage during certain times of the day, and they've downloaded Fruit Ninja on iPhone and iPad. Is there a way to sync Family Controls / ManagedSettings settings between iOS and iPad, like a user can create a unified account that monitors Fruit Ninja usage across both devices (without having to set up separate configs on each device?) I'm thinking of something like syncing ApplicationTokens, but I don't think this would work since I imagine the hashes will be different for the same app on different devices.
Posted
by