when i watch the video (https://developer.apple.com/videos/play/wwdc2022/110336/)
i find the code
let socialStore = ManagedSettingsStore(named: .social)
let socialCategory = database.socialCategoryToken
socialStore.shield.applicationCategories = .specific([socialCategory])
i try to find ManagedSettingsStore shield and specific([socialCategory]) i Documentation , but i failed.
who can tell me wher i can find about ManagedSettingsStore shield or specific([socialCategory]) ?
thanks a lot.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have a host application and I've added an extension to it. The bundle IDs of the two are different. Do I need to apply for a separate Provisioning Profile for the extension?
I am developing an app using DeviceActivity.
let schedule = DeviceActivitySchedule(
intervalStart: DateComponents(hour : 0, minute : 0, second: 1),
intervalEnd: DateComponents(hour : 23, minute : 59, second: 59),
repeats: true
)
I found that on the second day, intervalDidStart(for: DeviceActivityName) gets called multiple times.
I also tried
let schedule = DeviceActivitySchedule(
intervalStart: DateComponents(hour : 0, minute : 0, second: 1),
intervalEnd: DateComponents(hour : 23, minute : 59, second: 59),
repeats: false
)
and started monitoring for the next day in the intervalDidEnd(for: DeviceActivityName) method.
but , intervalDidStart(for: DeviceActivityName) still gets called multiple times.
How should I resolve this issue?
I am a Swift developer using the ScreenTime API to develop an app that helps users manage app usage time on their phones. While working with DeviceActivity, I've noticed that it sometimes gets activated multiple times in succession, and occasionally, the code within intervalDidStart stops executing midway. What could be the cause of this?
Topic:
Community
SubTopic:
Apple Developers
When using DeviceActivityMonitorExtension, I found that when repeats in DeviceActivitySchedule is true, the same DeviceActivityEvent under DeviceActivity on the next day will be triggered twice.
What I did wrong?
let schedule = DeviceActivitySchedule(
intervalStart: startInterval,
intervalEnd: endInterval,
repeats: false,
warningTime : DateComponents(hour : 0 , minute: 0 , second: 30)
)
```
I hope it will only be executed on the same day, but the monitoring is still there the next day. My system version is 18.2
I use DeviceActivityCenter to monitor app usage.
For DeviceActivityEvent, I set 30 events, and the threshold of each event increases by 2 minutes:
var events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [:]
for index in 0..<30 {
let threshold = (index == 29)
? DateComponents(hour: 1)
: DateComponents(minute: (index + 1) * 2)
let name = DeviceActivityEvent.Name("\(prefix)|\(index)")
events[name] = DeviceActivityEvent(applications: tokens, threshold: threshold)
}
After reaching the last DeviceActivityEvent, I will restart directly in DeviceActivityMonitor
private func restartMonitoring(activity: DeviceActivityName) {
let center = DeviceActivityCenter()
let currentEvents = center.events(for: activity)
do {
try center.startMonitoring(activity, during: schedule, events: currentEvents)
} catch {
print("Fail: \(error)")
}
}
But I found that after restarting, DeviceActivityEvent will be automatically executed even if I don't use the app.
My iOS version is 18.5
I started monitoring using the following code:
deviceActivityCenter.startMonitoring(
DeviceActivityName(name),
during: makeDailySchedule(),
events: events
)
Where:
DeviceActivitySchedule(
intervalStart: DateComponents(hour: 0, minute: 0),
intervalEnd: DateComponents(hour: 23, minute: 59),
repeats: true,
warningTime: nil
)
In DeviceActivityMonitor, I read and write data using UserDefaults and keep the logic minimal to ensure the size does not exceed 6MB.
However, after a period of time, monitoring continues to fail.
Why is this happening? How can I resolve this issue?
I’m manipulating some data inside a widget extension, and at the same time there is an active Live Activity (Dynamic Island / Lock Screen).
How can I update the Live Activity’s local notification when the data changes?
I tried accessing the current activity using Activity.activities, but it seems that this API is not accessible from inside the widget extension. What is the correct way to refresh or update the Live Activity in this case?
I am currently developing an app to help people focus on their work.
I use familycontrols , managedsettings and devie activity to develop it.
I am currently facing an issue where I would like to hide the app selected by the user from the main screen and resource library.
But I did not find any relevant information in the document. Who can help me.
I create two Extensions in my continer app.
Do I need create diffierent provisoning profiles for these Extensions ?
Hi everyone,
I am a beginner in Swift and I am currently using DeviceActivityMonitor to develop an app for parents to control their children's app usage time. During the development process, I found that the DeviceActivityMonitor has a 6MB memory limit in the background, and my app exceeds this limit after running for a long time. I would like to know how to reduce the memory usage of DeviceActivityMonitor in the background, or where I can check the memory usage of DeviceActivityMonitor and see which variables are consuming memory.
Additionally, I want to know if a new instance of the DeviceActivityMonitor class is created every time it is called?
Thank you for your help!
I am developing an application for managing screen time, and I encountered an issue when retrieving DeviceActivityEvent bound to a specific DeviceActivityName using the events method of DeviceActivityCenter. I noticed that the application token data bound to DeviceActivityEvent is missing. Could you help me understand why this might be happening?
How to display DeviceActivityReportScene in a widget.
When I was developing a widget, I found that DeviceActivityReportScene could not be displayed in the widget.
I have two apps that share data through an App Group. However, I’ve noticed that when one of the apps is uninstalled, the shared Core Data model is also uninstalled. If I don't create a shared model in one of the apps, I cannot access the data. What should I do to resolve this issue?