An app that uses screen time API.
After asking for permission and receiving them works, everything generally work, shields applications etc..
Upon new version update (manually update from testFlight old version or App Store)
I get an error message, I can then update again without any error but the permissions
are revoked and I have to ask for them again. shielding stopes.
This happens randomly on TestFlight or App Store and the permissions
Did anyone encounter this or solved this?
this seems to have started a month ago but maybe I just missed it before
Screen Time
RSS for tagShare and manage web-usage data, and observe changes made to Screen Time settings by a parent or guardian.
Posts under Screen Time tag
162 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Anyone had any luck modifying any of the Activity pickers with the view modifer. We've tried preferredColorScheme(_:) with no luck.
Stuck with black icons half the time - which doesn't match our UI.
We've had even less luck modifying the activityPicker sheet view to match our UI. A gigantic 'Choose Activity' sits right in the middle of our activity selection page which already has our own specific headers.
Not to mention trying add accessibility option into these views.
Anyone had better luck modifiying the activity picker views?
Hello,
I want to make a simple project that simply displays the user's current daily ScreenTime.
I believe you may be able to do the functionality I want with: FamilyControls or ScreenTime. I believe that you may need to pay for the paid developer account in order to access the FamilyControl framework.
I am having trouble finding guidance as to how I would do this as most reddit/stackoverflow posts are incomplete with answers and I cannot find demos/code examples/tutorials/sample usage anywhere on google.
I would greatly appreciate any help and guidance. If the solution requires the paid developer tier, I am fine with that. Thank you in advance
So I woke up today and I saw a screen time limit was placed on my phone. No one in my family placed the screentime limit, and I never placed one when I got my phone. I dont know a screen time passcode because I never made one, because I never set up a screentime limit. I tried restarting and force restarting, didnt work, I have no new updates so that doesnt work either. I dont know what to do. Ive watched like 6 hour video essays on this phone, and its never gave me a screentime limit or warning, so I know its a bug.
I have implemented a shielding mechanism via Family Controls to prevent unauthenticated users from deleting specific shortcuts within the Shortcuts app. While this successfully secures the app, it has an unintended consequence: the Shortcuts app no longer appears in Spotlight Search and becomes inaccessible for users subject to this shielding. I understand that this is the default behavior when implementing app shielding or time limits on specific apps. Is there a way to retain the app's visibility in Spotlight Search despite it being shielded?
I'm developing an iOS app that uses ScreenTime API.
Locally, everything works as expected - I have two physical devices in one Apple Family, and calling AuthorizationCenter.shared.requestAuthorization(for: .child) on a child device shows standard authorization dialog.
Currently the app is in a review by Apple, and they are saying they can't authorize as a child. From logs, and a screenshots provided by them, I see that on AuthorizationCenter.shared.requestAuthorization(for: .child) call, FamilyControlsError.restricted error is being thrown.
I didn't encounter this error once during development and can't simulate this issue now either. Tried everything - authorization on account that is not a child, not in a family, tried restricting everything possible for a child's device from ScreenTime settings. This specific error is never triggered.
Does anyone have idea why this error could happen? My last guess is the review team is using an enterprise account and that somehow intercepts with ScreenTime settings. But I don't have an enterprise account to test this theory.
Is there a way for me to programmatically check whether a user has disabled my app's access to Screen Time?
I currently request Family Controls / Screen Time access upon download by calling the following:
AuthorizationCenter.shared.requestAuthorization(for: .individual)
I need to be able to detect, though, when a user has gone into Settings -> Screen Time and disabled my app's Screen Time access. I tried calling the following:
AuthorizationCenter.shared.authorizationStatus
But it appears to have a value of Approved even after I turn off my app's Screen Time access.
Is there any way to accurately detect this in the code?
I am developing a project with the Screen Time API, and I cannot understand why the methods inside DeviceActivityMonitor extension are not being called. Some points to note:
I do start by requesting authorization from the User (this is working as expected when opening the app)
Both the DeviceActivityMonitor Extension and the main app are under the same App Group
I have added Family Controls capability to both targets and have the developer account to use it.
I start by calling center.startMonitoring()
I have overridden the original methods.
Yet, when startMonitoring is called, there is no action that is supposed to be taken that is being taken, and as far as I can tell, the methods aren't even being called.
Here are some relevant snippets of code:
// EXT
class DeviceActivityMonitorExtension: DeviceActivityMonitor {
override func intervalDidStart(for activity: DeviceActivityName) {
super.intervalDidStart(for: activity)
let store = ManagedSettingsStore(named: .daily)
}
override func intervalDidEnd(for activity: DeviceActivityName) {
super.intervalDidEnd(for: activity)
let store = ManagedSettingsStore(named: .daily)
store.clearAllSettings()
}
override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
super.eventDidReachThreshold(event, activity: activity)
let store = ManagedSettingsStore(named: .daily)
let model = BeeFreeModel.shared
let applications = model.selectionToDiscourage.applicationTokens
let categories = model.selectionToDiscourage.categoryTokens
let webDomains = model.selectionToDiscourage.webDomainTokens
store.shield.applications = applications.isEmpty ?
nil : applications
store.shield.applicationCategories = categories.isEmpty ?
nil : ShieldSettings.ActivityCategoryPolicy.specific(categories)
store.shield.webDomains = webDomains.isEmpty ?
nil : webDomains
}
}
// APP
extension DeviceActivityName {
static let daily = Self("daily")
}
extension DeviceActivityEvent.Name {
static let discouraged = Self("discouraged")
}
let schedule = DeviceActivitySchedule(
intervalStart: DateComponents(hour: 0, minute: 0, second: 0),
intervalEnd: DateComponents(hour: 23, minute: 59, second: 59),
repeats: true
)
class BeeFreeSchedule {
static public func setSchedule() {
print("Setting schedule...")
print("Hour is: ", Calendar.current.dateComponents([.hour, .minute], from: Date()).hour!)
let events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [
.discouraged: DeviceActivityEvent(
applications: BeeFreeModel.shared.selectionToDiscourage.applicationTokens,
categories: BeeFreeModel.shared.selectionToDiscourage.categoryTokens,
webDomains: BeeFreeModel.shared.selectionToDiscourage.webDomainTokens,
threshold: BeeFreeModel.shared.thresholdToDiscourage
)
]
let center = DeviceActivityCenter()
do {
print("Try to start monitoring...")
// Call startMonitoring with the activity name, schedule, and events
try center.startMonitoring(.daily, during: schedule, events: events)
} catch {
print("Error monitoring schedule: ", error)
}
}
}
// APP
class BeeFreeModel: ObservableObject {
// Import ManagedSettings to get access to the application shield restriction
let store = ManagedSettingsStore()
//@EnvironmentObject var store: ManagedSettingsStore
@Published var selectionToDiscourage: FamilyActivitySelection
@Published var thresholdToDiscourage: DateComponents
@Published var setOfApps: [String]
init() {
selectionToDiscourage = FamilyActivitySelection()
thresholdToDiscourage = DateComponents()
var setOfAppIdentifiers: Set<String?> = Set<String?>()
setOfApps = [String]()
if selectionToDiscourage.applicationTokens.isEmpty {}
else {
for application in BeeFreeModel.shared.selectionToDiscourage.applications {
setOfAppIdentifiers.insert(application.localizedDisplayName)
setOfApps = setOfAppIdentifiers.compactMap { $0 }.sorted()
}
}
}
class var shared: BeeFreeModel {
return _BeeFreeModel
}
func setSelection() {
let applications = BeeFreeModel.shared.selectionToDiscourage
}
func changeThreshold(threshold: DateComponents) {
thresholdToDiscourage = threshold
}
}
// APP
/// ...
Button("Select Apps to Discourage") {
isDiscouragedPresented = true
}
.familyActivityPicker(isPresented: $isDiscouragedPresented, selection: $model.selectionToDiscourage)
}
.onChange(of: model.selectionToDiscourage) {
BeeFreeModel.shared.setSelection()
}
// ...
// ...
Button("Save Time") {
saveTime()
let new_threshold = DateComponents(hour: savedTime?.hours,
minute: savedTime?.minutes,
second: savedTime?.seconds)
model.changeThreshold(threshold: new_threshold)
}
}
.onChange(of: model.thresholdToDiscourage) {
BeeFreeSchedule.setSchedule()
// ...
I believe I am using the latest stable version of Xcode (recently deleted and reinstalled). I'm really new to mobile development to Swift so any help is greatly appreciated.
Thank you! :)
At 11:37 in this video - https://developer.apple.com/videos/play/wwdc2021/10123/ - Nolan instantiates MyModel() in swiftui view file. And then at 12:02 he just uses MyModel from extension.
I have the exact same code and when I try to build my project, it fails with error that MyModel() could not be found.
I shared my MyModel.swift file between extension target and main app. Now it builds. However, it seems there are two separate instances of MyModel.
What is proper way for DeviceActivityMonitor extension to pass data to main app? I simply want to increment counter from extension every minute and let the main app to know that.
Or even better, - is there a way to use SwiftData from Device Activity Monitor extension?
I am 17, almost 18 years old and still have screen time restrictions on my phone. My downtime every night turns off at midnight, then later turns back on at 7:30 am. Last night I plugged in my phone to go to bed and when I woke up it says that instagram was being used for 4 1/2 hours from 2am to 7am. This is impossible because of my downtime restrictions and now I have no time left on my apps for the day. Does anyone know how to fix this?
Our app uses Family Control and have 2 extensions for monitoring and shielding.
We got Family controls Distribution entitlement for main app bundle and we have applied to get for extensions too, but its like 2 months we didn't get the Distribution entitlements for extensions. We need to upload the app to TestFlight, but without Distribution entitlements for extensions we can't do it.
Bundle id exp:
com.example.example -- Distribution entitlement provided
com.example.example.MonitorExtension -- only development entitlement
com.example.example.ShieldConfiguratoionExtension -- only development entitlement
Is there nay workaround?
App with DeviceActivityReport extension either won't install on device or won't upload to TestFlight
We have integrated DeviceActivityReport to our Family Controll app. All capabilities are added. We built the app and tested it, but when we want to upload to TestFlight the following error happened (see attached image)
When we are adding NSExtensionMainStoryboard or NSExtensionPrincipalClass the following error appears during installation process.
DeviceReport.appex with id com.example.example.DeviceReport defines either an NSExtensionMainStoryboard or NSExtensionPrincipalClass key, which is not allowed for the extension point com.apple.deviceactivityui.report-extension
Experiencing a very strange issue with 3rd party permissions not working on screen time as of yesterday on my device (iPhone 12, iOS 17.2.1) and we are concerned that other users may end up dealing with this if it's not resolved.
The video attached demonstrates what I mean but this is happening across every single screen time application, not just Opal or ours. I tried resetting my device, hard reboots, deleting and redownloading the apps, updating my phone, and turning screen time off and back on but nothing has worked. I also submitted my feedback (FB13540567)
We are requesting authorization from AuthorizationCenter as a child, and that works as expected. But revoking is always approved, I assumed the guardian would have to identify on the device to approve the revoking.
Is this intended behavior or a bug?
Over a month ago, I submitted the Family Controls Entitlement form: https://developer.apple.com/contact/request/family-controls-distribution
For an app I'm developing and I've received 0 feedback. No case number, no email and I've called and emailed support 3 times but they haven't been able to help me.
When can I expect to hear back from the Family Controls team, what's the average wait time.
When trying to open an app that uses Local Authentication (FaceID) the auth process does not start right away, 3-4 times trying to auth is needed in order to get authenticated with the method the user has selected (FaceID), this is happening with many apps and seems that there's no a workaround.
[Edited by Moderator]
Our users report frequent crashes with the FamilyActivityPicker. Since this is a screen controlled by Apple, I'm assuming that there's nothing I can do to prevent these crashes.
I'm wondering, though, if there's any way to gracefully handle these crashes? When this happens, the following is printed to the console:
[com.apple.FamilyControls.ActivityPickerExtension(1121)] Connection to plugin invalidated while in use.
Does anyone know how to handle/catch this error?
I am able to correctly select and store the tokens of apps and categories my users will block, but I am unable to pre-populate Picker whenever the app is rebooted with previously selected and stored tokens. Below is the selection variable I am passing to the picker...
var selectionsToBlock = FamilyActivitySelection() {
willSet {
saveSelection(selection: newValue)
blockersSelected = true
}
}
Is there any way I can provide my existing blockers (shown below) so that the user can easily edit their list of restricted apps from the Picker?
func savedBlockers() -> FamilyActivitySelection? {
let defaults = UserDefaults.standard
guard let data = defaults.data(forKey: userDefaultsKey) else {
return nil
}
return try? decoder.decode(
FamilyActivitySelection.self,
from: data
)
}
Hello, I am able to have users properly select apps that my app can limit and block, however I am having a lot of trouble figuring out how to restrict access for set periods of times. For example, I want the user to select the apps they wish to block, store them so they can be reused later and whenever they press a button restrict access for the next 30 minutes.
I understand this is doable if they are actively on the app, but I do not know how to automate the lifting of this restriction after the given period.
Moreover, what is the best way to persist the category and application tokens selected via the FamilyActivitySelector?
I'm developing a mental wellness app, and I need to get user's screentime and app usage data and send it to my flask backend for analytics. Is it possible on iphone right now?
I've looked into ScreenTime and DeviceActivity frameworks, but they're really poor in terms of examples and documentation, so I'm not sure if this is actually possible or not.