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

106 Posts
Sort by:
Post not yet marked as solved
0 Replies
68 Views
I'm looking to make an app using the ScreenTime API and the Managed Settings Framework. I'm experimenting with the FamilyActivityPicker, but when i open it from the simulator i see only categories with no applications. Without being able to select applications, i cannot test properly the app. I can't install it on a real device to test it because i do not have a paid Apple Developer account and therefore can't access the capability if i select my Free Developer Account in order to install it on my iPhone.
Posted
by Clucch.
Last updated
.
Post not yet marked as solved
0 Replies
119 Views
I have tried to deploy passwordpolicy script using pwpolicy pwpolicy -n /Local/Default -setglobalpolicy "usingHistory=5 canModifyPasswordforSelf=1 maxMinutesUntilChangePassword=129600 requiresAlpha=1 requiresNumeric=1 minChars=8 passwordCannotBeName=1 requiresMixedCase=1 requiresSymbol=1" sudo defaults write /Library/Preferences/com.apple.loginwindow PasswordExpirationDays 14 errcode=$? if [ "$errcode" -ne 0 ]; then echo "" echo "Failed to apply with errorcode $errcode" 1>&2 echo "" exit 1 fi echo "Password Policy applied successfully" 1>&2 After deploying, on next login, It prompted for login, On entering password, It shows wrong password. When I tried to reset the password, It is not accepting the password. Instead It prompts again and again. Like this , I have got 300 mac machines struck in login page. I tried to run these two commands via a app running in root pwpolicy -u "$user" -clearaccountpolicies pwpolicy -clearaccountpolicies After Running this, I can able to loggin for first time. When tried to login second or successive times, It is failing with wrong password or sometimes no error instead of a jumping prompt in password page. When tried to change password after a login after clearpolicy command, It is not accepting the admin's password (Which was used to login the current session). Please help on this issue. As it does have a serious impact.
Posted Last updated
.
Post not yet marked as solved
7 Replies
1.3k Views
Hi ! We are super exited to switch to Xcode 15 when it will be released, but we have a major issue : Apps built with Xcode 15 beta fail to show DeviceActivityReport base view on iOS 16. The following message shows in the console : ] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} 2023-07-31 14:54:12.568332+0200 Opal[57940:4651501] [default] Attempt to map database failed: permission was denied. This attempt will not be retried. 2023-07-31 14:54:12.568420+0200 Opal[57940:4651501] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} We Opened a bug report at the end of june but got no answer from Apple (FB12416769). It's 100% reproductible with a very simple sample project If you guys could report the issue as well, it would be nice !
Posted
by _lilpit.
Last updated
.
Post not yet marked as solved
0 Replies
104 Views
I am developing a parental control app using Flutter and platform channels to integrate with the Screen Time API on iOS. The app has two interfaces - one for the parent and one for the child. I have set up Family Sharing correctly and installed the app on both the parent's and child's devices. However, I am encountering some issues with the Family Activity Selection feature. It's worth noting that I am a Flutter developer with limited knowledge of Swift and iOS development, so if my issues stem from a mistake I made, please forgive me. The problems I am facing are as follows: When calling the family activity selection, the list of apps shown in the apps sheet is from the parent's device, and no apps from the child's device are displayed. I have double-checked that Family Sharing and other necessary configurations are set up correctly, including the family control capability. Even if I select apps on the parent's device, the selected apps are not returned in the result. The returned array is empty. Additionally, there is no close or done button on the sheet, and drag-to-dismiss is not working either. This might be an issue with the way I have written the code (most of the native code was generated by AI assistants like Claude and GPT, as I am a Flutter developer with limited knowledge of Swift and iOS development). I have tested other parental control apps that use the Screen Time API and observed the same issue, where the parent's apps are shown on the parent's device instead of the child's apps. For more context, I have provided the relevant code snippet below: import Flutter import FamilyControls import ManagedSettings import SwiftUI class FamilyActivityHandler: NSObject, FlutterPlugin { // ... private func openFamilyActivityPicker(result: @escaping FlutterResult) { let store = ManagedSettingsStore() let selection = FamilyActivitySelection() // Adjusting for UIWindowScene for iOS 15 and later guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let window = windowScene.windows.first else { result(FlutterError(code: "NO_WINDOW_SCENE", message: "No window scene found", details: nil)) return } let viewController = UIHostingController(rootView: FamilyActivityPicker(selection: .constant(selection))) viewController.modalPresentationStyle = .formSheet window.rootViewController?.present(viewController, animated: true, completion: nil) DispatchQueue.main.async { let applications = selection.applicationTokens let categories = selection.categoryTokens let webDomains = selection.webDomainTokens store.shield.applications = applications.isEmpty ? nil : applications store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set()) store.shield.webDomains = webDomains // Custom method to generate descriptive strings for tokens let applicationsDescription = applications.map { token in // Implement a custom description method or use an identifier property "\(token)" } let categoriesDescription = categories.map { token in // Implement a custom description method or use an identifier property "\(token)" } let webDomainsDescription = webDomains.map { token in // Implement a custom description method or use an identifier property "\(token)" } let resultDict: [String: Any] = [ "applications": applicationsDescription, "categories": categoriesDescription, "webDomains": webDomainsDescription ] result(resultDict) } } } I would greatly appreciate any guidance or insights from the community on how to resolve these issues and properly implement the Family Activity Selection feature using the Screen Time API in a Flutter app with platform channels. Thank you in advance for your help!
Posted
by amalshyjo.
Last updated
.
Post not yet marked as solved
0 Replies
87 Views
I am developing a parental control app using Flutter and platform channels to integrate with the Screen Time API on iOS. The app has two interfaces - one for the parent and one for the child. I have set up Family Sharing correctly and installed the app on both the parent's and child's devices. However, I am encountering some issues with the Family Activity Selection feature. It's worth noting that I am a Flutter developer with limited knowledge of Swift and iOS development, so if my issues stem from a mistake I made, please forgive me. The problems I am facing are as follows: When calling the family activity selection, the list of apps shown in the apps sheet is from the parent's device, and no apps from the child's device are displayed. I have double-checked that Family Sharing and other necessary configurations are set up correctly, including the family control capability. Even if I select apps on the parent's device, the selected apps are not returned in the result. The returned array is empty. Additionally, there is no close or done button on the sheet, and drag-to-dismiss is not working either. This might be an issue with the way I have written the code (most of the native code was generated by AI assistants like Claude and GPT, as I am a Flutter developer with limited knowledge of Swift and iOS development). I have tested other parental control apps that use the Screen Time API and observed the same issue, where the parent's apps are shown on the parent's device instead of the child's apps. For more context, I have provided the relevant code snippet below: import Flutter import FamilyControls import ManagedSettings import SwiftUI class FamilyActivityHandler: NSObject, FlutterPlugin { // ... private func openFamilyActivityPicker(result: @escaping FlutterResult) { let store = ManagedSettingsStore() let selection = FamilyActivitySelection() // Adjusting for UIWindowScene for iOS 15 and later guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let window = windowScene.windows.first else { result(FlutterError(code: "NO_WINDOW_SCENE", message: "No window scene found", details: nil)) return } let viewController = UIHostingController(rootView: FamilyActivityPicker(selection: .constant(selection))) viewController.modalPresentationStyle = .formSheet window.rootViewController?.present(viewController, animated: true, completion: nil) DispatchQueue.main.async { let applications = selection.applicationTokens let categories = selection.categoryTokens let webDomains = selection.webDomainTokens store.shield.applications = applications.isEmpty ? nil : applications store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set()) store.shield.webDomains = webDomains // Custom method to generate descriptive strings for tokens let applicationsDescription = applications.map { token in // Implement a custom description method or use an identifier property "\(token)" } let categoriesDescription = categories.map { token in // Implement a custom description method or use an identifier property "\(token)" } let webDomainsDescription = webDomains.map { token in // Implement a custom description method or use an identifier property "\(token)" } let resultDict: [String: Any] = [ "applications": applicationsDescription, "categories": categoriesDescription, "webDomains": webDomainsDescription ] result(resultDict) } } } I would greatly appreciate any guidance or insights from the community on how to resolve these issues and properly implement the Family Activity Selection feature using the Screen Time API in a Flutter app with platform channels. Thank you in advance for your help!
Posted
by amalshyjo.
Last updated
.
Post not yet marked as solved
0 Replies
75 Views
Hello, I am working on a screen time manager that can block certain apps. I want this to work by allowing a certain number of 5-minute sessions per day. For each app the user selects, I would like to store the number of sessions remaining for that app in a dictionary. Currently, I am storing them in a dictionary of type <AppToken: Int>. However, I would like to store this dictionary to UserDefaults, and it doesn't seem like it is possible to store the type AppToken to UserDefaults. I was wondering how I could go about storing the AppTokenas a String and maybe saving to UserDefaults as a <String: Int> instead? Thanks.
Posted Last updated
.
Post not yet marked as solved
0 Replies
107 Views
I am currently debugging an issue with DeviceActivityMonitor where the threshold is reached even though the target app (e.g. Instagram) is not being used actively. I noticed that the device with the unexpected behavior had the instagram.com website opened in the Safari web browser (among hundreds of other tabs). That tab was not actively used either (not in foreground, Safari app neither used). However, I was wondering if it can happen that this website is contributing towards the threshold as well even though it is in background and not used? Otherwise I cannot explain myself this strange behavior.
Posted
by Quappi.
Last updated
.
Post marked as solved
1 Replies
179 Views
Hi, I use ScreenTime API for proving feature of hiding other installed apps in the iOS device. 
Specifically I set applications I want to hide to this property of ManagedSettingsStore.application.blockedApplications. Documentation to this propery says The system hides blocked applications and prevents the user from launching them. There is no any limitations or deprecation labels, api available starting iOS 15. My app is in the AppStore and works good, but I received reject for app update saying: The app uses public APIs in an unapproved manner, which does not comply with guideline 2.5.1. Specifically, your app still uses Screentime API to hide apps from user. Since there is no accurate way of predicting how an API may be modified and what effects those modifications may have, unapproved uses of public APIs in apps is not allowed. This sounds odd to me as feature is documented, not marked as deprecated and confirmed on forum by Apple Engineer it’s available for developers. Additionally I can’t find any public information about “unapproved uses of public APIs” that reviewer refers to. So there are literally no reason to reject my app as feature is documented and I use it as it's prescribed. The only public requirement for the developers found in Apple Review Guidelines and Apple Developer Program License Agreement is to use public API, there is no term "unapproved uses of public APIs". After long conversation with reviewer I submitted appeal but review board didn't provide any clarity and declines my appeal with exactly the same response without clarifying situation and referring to 2.5.1 that is actually not applicable. Looking forward to finding any useful information, experiences from other developers, or clarifications from Apple Engineers.
Posted Last updated
.
Post not yet marked as solved
2 Replies
654 Views
currently when I try to set several schedules to the same activity the latest schedule I set is the only one I understand I can have only 1 schedule for activity. ? I thought about setting a new schedule on the intervalDidEnd but, I get no interval did start if the current time is in the middle of the interval I set For example, now it is 15:00, and my previous interval started at 14:00 and ends at 16:00 but the user sets a new interval from 14:30 - 16:40 I call the deviceActivityCenter.stopMonitoring([someActivityName]) and get noIntervalDidEnd event Then I set the new interval successfully with deviceActivityCenter.startMonitoring(someActivityName, during: deviceActivitySchedule) and get no intervalDidStartEvent So how can I achieve several intervals? If I had gotten the events of the start and end it would be possible Thanks for the help
Posted
by Boaz F..
Last updated
.
Post not yet marked as solved
2 Replies
211 Views
As per our code, we have the apps to be shielded whenever the threshold is reached. According to this use-case, our code in DeviceActivityExtension looks something like: override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventDidReachThreshold(event, activity: activity) defaults?.setValue(event.rawValue, forKey: "appLimitEventName") defaults?.setValue(true, forKey: "appLimitReached") defaults?.synchronize() // using darwinNotificationCenter to trigger callback in the application let darwinNotificationCenter = DarwinNotificationsManager.sharedInstance() darwinNotificationCenter.postNotification(withName: "nextAppLimitInitiated") // using Notifications to debug since print doesn't work scheduleNotification(with: "interval threshold reached") } And in our application, we have the shielding logic in place, init() { let darwinNotificationCenter = DarwinNotificationsManager.sharedInstance() darwinNotificationCenter.register(forNotificationName: "nextAppLimitInitiated"){ print("callback received") let appLimitReached = self.defaults?.bool(forKey: "appLimitReached") let appLimitEventName = self.defaults?.string(forKey: "appLimitEventName") if appLimitReached ?? false, appLimitEventName != "" { // this sends the notification when callback is received self.scheduleNotification(with: "init start") self.defaults?.setValue(false, forKey: "appLimitReached") guard var dataArray = self.defaults?.array(forKey: "appLimitdataArray"), !dataArray.isEmpty else { return } let appLimitData = dataArray.first as! NSDictionary let appLimitKey = appLimitData["appLimitId"] as! String let data = self.getSchedule(key: appLimitEventName ?? "") if let appTokens = data?.applicationTokens { for token in appTokens { if !self.applicationTokens.contains(appTokens) { self.applicationTokens.insert(token) } } } self.store.shield.applications = self.applicationTokens self.store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(self.categoryTokens, except: Set()) dataArray.removeFirst() //dataArray.append(appLimitData) self.defaults?.set(dataArray, forKey: "appLimitdataArray") self.initiateMonitoring(initiateAgain: true) self.scheduleNotification(with: "init end") } } } This works as expected for multiple App Limits but only when the device is connected to the Xcode. If we disconnect the device from Xcode/ stop application from Xcode/ try in release mode, the callback is not received from extension to the app/init block. When the device is connected to Xcode, if the apps hit the threshold, they are shielded automatically. But if the device is disconnected/ app is in release mode, the apps are not shielded automatically even after the threshold is reached. It is shielded later only after opening our app once. Please let me know if I'm doing anything wrong in receiving callback or in my shielding logic. If I need to place the shielding logic in the extension, please tell me how I can handle multiple appTokens.
Posted Last updated
.
Post marked as solved
1 Replies
290 Views
I am trying to understand how to approach 'x minute' pauses for a DeviceActivitySchedule. For instance, I would like to let the user pause for 5 minutes from an active schedule (meaning un-shielding the apps and re-applying the shield after the 5 min has passed). The only way that came to my mind was calling the following: Calling .startMonitoring to start monitoring a new event with the same apps starting .now and ending .now + 5 minutes; Calling in the intervalDidStart, store.shield.applications.subtract(apps) so that the apps are removed from the shield. Calling in the intervalDidEnd, store.shield.applications = apps so that the apps are now shielded again. The problem is that, from the Apple Developer Documentation: The minimum interval length for monitoring device activity is fifteen minutes. So the minimum pause I could offer to the user would be 15 minutes. And that tells me this approach is most likely wrong, because all other Screen Time apps, like Opal, Jomo, AppBlock offer also 5 min pause. Does anyone know / can think of a different and better approach?
Posted
by Ivan018.
Last updated
.
Post not yet marked as solved
0 Replies
159 Views
I am relatively new to swift, and working on an app blocker using flutter and swift. In my Xcode runner file, I used File > New > Target > ShieldConfigurationExtension and File > New > Target > ShieldActionExtension to create the extensions with all the necessary Info.plist values. However, when I try to build, I am presented with this error message: Error (Xcode): Cycle inside Runner; building could produce unreliable results. Cycle details: → Target 'Runner': CodeSign /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app ○ That command depends on command in Target 'Runner': script phase “[CP] Copy Pods Resources” ○ That command depends on command in Target 'Runner': script phase “Thin Binary” ○ Target 'Runner' has process command with output '/Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/Info.plist' ○ Target 'Runner' has copy command from '/Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/shieldAction.appex' to '/Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/PlugIns/shieldAction.appex' 2 Raw dependency cycle trace: target: -> node: <all> -> command: <all> -> node: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/_CodeSignature -> command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:CodeSign /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app -> node: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/GoogleSignIn.bundle/ -> directoryTreeSignature: [ -> directoryContents: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/GoogleSignIn.bundle -> CYCLE POINT -> node: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/GoogleSignIn.bundle -> command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:PhaseScriptExecution [CP] Copy Pods Resources /Users/arshgupta/Library/Developer/Xcode/DerivedData/Runner-gkxkhzabeikourbemhpfsdwlgfor/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/Script-F71E8F68D8E3D1B95F11D101.sh -> node: /Users/arshgupta/Library/Developer/Xcode/DerivedData/Runner-gkxkhzabeikourbemhpfsdwlgfor/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/InputFileList-F71E8F68D8E3D1B95F11D101-Pods-Runner-resources-Debug-input-files-276c84640d21f41dd725929b3125799d-resolved.xcfilelist -> command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:WriteAuxiliaryFile /Users/arshgupta/Library/Developer/Xcode/DerivedData/Runner-gkxkhzabeikourbemhpfsdwlgfor/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/InputFileList-F71E8F68D8E3D1B95F11D101-Pods-Runner-resources-Debug-input-files-276c84640d21f41dd725929b3125799d-resolved.xcfilelist -> node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase4-thin-binary> -> command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase4-thin-binary -> node: <execute-shell-script-18c1723432283e0cc55f10a6dcfd9e02f1eee2015e8ff5ebcd27678f788c2826-target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-> -> command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:PhaseScriptExecution Thin Binary /Users/arshgupta/Library/Developer/Xcode/DerivedData/Runner-gkxkhzabeikourbemhpfsdwlgfor/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/Script-3B06AD1E1E4923F5004D2608.sh -> node: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/Info.plist/ -> directoryTreeSignature: R -> directoryContents: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/Info.plist -> node: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/Info.plist -> command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:ProcessInfoPlistFile /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/Info.plist /Users/arshgupta/Documents/pledge-1/ios/Runner/Info.plist -> node: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/PlugIns/shieldAction.appex -> command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:Copy /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/PlugIns/shieldAction.appex /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/shieldAction.appex -> node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase5--cp--copy-pods-resources> -> command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase5--cp--copy-pods-resources -> node: /Users/arshgupta/Documents/pledge-1/build/ios/Debug-iphoneos/Runner.app/GoogleSignIn.bundle What can I do to fix this?
Posted Last updated
.
Post not yet marked as solved
0 Replies
131 Views
I have two repeating DeviceActivitySchedules running in my app and noticed a super strange behavior: whenever I modify Screen Time API permission settings (granting an additional app permission, or removing permission for a different app (completely different unrelated screen time apps from App Store)) all my DeviceActivitySchedules are cancelled and the intervalDidEnd callbacks are called my permission is not modified in this scenario this is a super strange and unexpected behavior is anyone able to reproduce this? for me this happens 100% of the times I do this any known workarounds?
Posted
by Quappi.
Last updated
.
Post not yet marked as solved
0 Replies
128 Views
I updated to IOS 1.17.4.1 and now developer mode on my iPhone is not only off, but I'm not able to turn it back on because there's no option under Privacy and Security, when I search it up, and nothing shows up. Is there any way to fix this?
Posted
by aiyoof.
Last updated
.
Post not yet marked as solved
0 Replies
165 Views
Hello, I am using a DeviceActivityEvent to limit access to an app after the user has spent x minutes on it. Sometimes it can happen that a DeviceActivitySchedule spans from 11:55pm - 12:25am (just an example). In these cases, I have noticed, the DeviceActivityMonitorExtension’s eventDidReachThreshold is not called after the user has reached the threshold time interval in the observed app. I assume this is because we have transitioned over midnight and something weird happens to the DeviceActivitySchedule. I’ve tried adding the day components to the DeviceActivitySchedule as well, but then it fails completely. Any advice how to handle this? I could, of course, create two separate DeviceActivitySchedules: one for before midnight, and one for after. But depending on the user’s real app usage that could lead to slightly different (and unexpected) behavior.
Posted
by Quappi.
Last updated
.
Post not yet marked as solved
3 Replies
733 Views
Hi there, In rare cases (about 0.2% of the time?), I'm seeing calls to startMonitoring on an instance of DeviceActivityCenter throw an error with localizedDescription "couldn’t communicate with a helper application." I am certain I am passing valid parameters to the startMonitoring call because sometimes a naive retry after a few seconds succeeds. Similarly, I am certain that FamilyControls permissions have been granted by the user. Was hoping to get more color from the systems team on what some causes of this error are and if it is avoidable by the programmer.
Posted Last updated
.
Post not yet marked as solved
0 Replies
184 Views
If we want to un-shield category/application for particular schedule, then what is the mechanism for this, as for now we are using ManagedSettingsStore().shield.applications = nil and ManagedSettingsStore().shield.applicationCategories = nil, which is actually un-shielding all category/applications without considering the selection of category/application for that schedule. What is the best approach to handle multiple schedules for shielding of apps?
Posted Last updated
.
Post not yet marked as solved
1 Replies
616 Views
Starting with iOS 17.4, the DeviceActivityEvent initializer includes a new parameter named includesPastActivity.

The default value for this parameter is set to false, whereas device activity events have behaved as though this parameter were set to true up until now. This breaking change is a MAJOR ISSUE for developers who used device activity events in their apps before iOS 17.4 because their apps might not work the way they intended after the update. They'll have to release new app versions that specifically set includesPastActivityto true. In my opinion, the default value for includesPastActivity should be true to avoid disrupting events scheduled on older versions of iOS. I have filed an enhancement report (FB13573556) about this. I really hope this is changed before the official iOS 17.4 release.
Posted Last updated
.
Post not yet marked as solved
0 Replies
197 Views
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 it's not. I implemented it as recommended as a separate Extension Target. For more context, here is my DeviceActivityMonitor: class DeviceActivityMonitorExtension: DeviceActivityMonitor { let store = ManagedSettingsStore() let logger = Logger() override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) logger.log("INTERVAL STARTED") let model = ShieldManager.shared let applications = model.selectionToDiscourage.applicationTokens let categories = model.selectionToDiscourage.categoryTokens let webCategories = model.selectionToDiscourage.webDomainTokens store.shield.applications = applications.isEmpty ? nil : applications store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set()) store.shield.webDomains = webCategories.isEmpty ? nil : webCategories } ... What's confusing me is that the apps are in fact shielded, so the MonitorExtension should be called, but neither the logging works nor my separate ShieldConfigurationExtension, maybe the issues are connected... Any help would be gladly appreciated!
Posted Last updated
.