Kmart, I highly appreciate your quick response and provided answers for each of my questions!
I'm clear with 2nd, 3rd, 4th and 5th. Let me clarify the 1st one please:
In order to exclude device usage from the beginning of the day, use the hour/minute/second components of Date.now as the start components of your schedule. If you are trying start a repeating schedule from 12:00am to 11:59pm, you might need to use two different schedules: a non-repeating schedule for the first "partial" day and then when you get the intervalDidEnd callback for that first "partial" day, you can then start monitoring your actual repeating schedule for 12:00am to 11:59pm.
For creating schedules from the beginning of the day I do so:
let mondaySchedule = DeviceActivitySchedule(
intervalStart: DateComponents(hour: 0, minute: 0),
intervalEnd: DateComponents(hour: 23, minute: 59),
repeats: true
)
I'm trying to reach a vice versa implementation:
I'd like to create a repeatable schedule, let say for each Monday, and this schedule has to invoke eventDidReachThreshold. On top of it, I'd like to create another one "partial" repeatable schedule, let say on Monday from 2pm to 4pm, this schedule hasn't invoke eventDidReachThreshold.
So, my question is: Is eventDidReachThreshold has to work properly, in case it was programmed for the whole repeatable day schedule?
And what if I'd like to create the same schedules for Tuesday (both, for whole day and "partial" and both are repeatable), will it have negative impact on Monday's schedules and for the eventDidReachThreshold event?
Post
Replies
Boosts
Views
Activity
Kmart, what if day already ended, but eventDidReachThreshold invokes anyway? What if on the previous day, I didn’t open specified apps, but eventDidReachThreshold invokes anyway? Where else could be the problem?
Same issue!
Kmart, what if day already ended, but eventDidReachThreshold invokes anyway? What if on the previous day, I didn’t open specified apps, but eventDidReachThreshold invokes anyway? Where else could be the problem?
Example of working solution
let store = ManagedSettingsStore
The code below will hide Safari's icon from home screen:
let safari = Application(bundleIdentifier: "com.apple.mobilesafari")
let blockedApplications: Set<Application> = [safari]
store.application.blockedApplications = blockedApplications
To display it back do this:
store.application.blockedApplications = []
Systems Engineer, thank you for your reply!
Your example is exactly what I'm doing in the project. I'm using iOS 16.3.1 on the test device.
Tell me please, is there any possibility that version of: macOS, Xcode or Xcode command line tools could have impact on that behaviour?
I'm 100% sure I'm using single ManagedSettingsStore across the app. Btw, could you please share the link or some info in case we using store for iOS15? I'd like to see the mechanism of its synchronisation.
Thank you in advance!
Like this?:
let mobilesafari = Application(bundleIdentifier: "com.apple.mobilesafari")
let mobilesafariToken = mobilesafari.token
Fetching Safari's token as above always returns nil...
Oh, thank you for the detailed explanation! Of course I'd like to see it. These things seems obvious for me, and I actually wondered why it weren't implemented before the API was released.
Is it real chance that Apple will implement it after report via Feedback Assistant?)
Have the same issue.
Despite the link is broken, it helped. Thank you!
Strange behaviour of selecting multiple apps or category...
for some category (Productivity) I'm able to block all apps
for other category (Entertainment) when I select whole category, there are some apps blocked and some not
for third category (Social) if select all apps, none of them will be blocked
Why it's happening?
You can find the link to GitHub with the source code mentioned in the video in this answer. Be aware that it's not official, and there are some gaps, but you will noticed it when you compare code with video.
Leo, in case you also faced with this issue or just passed it without any problems, please share you experience.
I'll appreciate it! 🙏
Hi Leo and other folks who is stack with this. You need to do next:
You need to request ENTITLEMENT KEYS (com.apple.developer.family-control).
You must do it only from Account Holder. Even if you Admin - you can’t do it. Wait for Apple’s approval. It could takes up to the week. You will receive an email related to Account Holder.
You must do it only from Account Holder. Even if you Admin - you can’t do it. Wait for Apple’s approval.
After you’ve got approval, go to the Identifiers, choose your app’s id, open it. Now you should find Additional Capabilities tab. There should be Family Controls (Distribution) - just Enable it.
Create new Provisioning certificates, download, install.
(Optional) To make sure everything is setup correct, you can do the dump of your new certificate before install it, but this step is not required. If you going to do that, you can check Eskimo's answer, you need to only 5th step.
(Optional) It will be good to clean your Keychain with old certificate related to your app, before you install new one.
Make sure you’ve added Family Controls Capability in the Xcode and you can see it in .entitlements file.
Fingers crossed🤞 Now everything should work 🔥
Glory to Ukraine 🇺🇦
Hey once again, Kmart :)
Thank you for the answer! I've tried both variants, and both lead to issues...
Is the Documentation up to date?
Have I been doing something wrong?
The question is old, but for newcomers...
Managed Settings, Family Controls, Device Activity - these three frameworks actually represent the Screen Time API.