Meet the expanded San Francisco font family

RSS for tag

Discuss the WWDC22 Session Meet the expanded San Francisco font family

Posts under wwdc2022-110381 tag

1 result found
Sort by:
Post not yet marked as solved
3 Replies
1k Views
Hello, I am trying to make use of Screentime API in my app, I have issue with the DeviceActivityMonitor extension. I have schedule DeviceActivitySchedule which I set like this: let schedule = DeviceActivitySchedule( intervalStart: DateComponents(hour: 00, minute: 00), intervalEnd: DateComponents(hour: 23, minute: 59), repeats: false ) and DeviceActivityEvent which I set like this: let dateComponent = DateComponents(minute: 1) var events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [ .encouraged: DeviceActivityEvent(threshold: dateComponent) ] The issue is that every time I start monitoring, by calling this piece of code from the app: do { print("Try start monitoring...") try center.startMonitoring(.daily, during: schedule, events: events) } catch { print("Error: ", error) } I catch in the extension that the event intervalDidStart is called, but in the same second I get called eventDidReachThreshold. What could be done wrong? Is event set properly? I was trying to set event with different Datecomponents (minute, hour, second), by setting different amount of time, like: let dateComponent = DateComponents(minute: 3) let dateComponent = DateComponents(second: 120) but nothing worked differently, every time, it was triggering eventDidReachThreshold right after the interval starts. If I put something unnormally high, like: let dateComponent = DateComponents(second: 120) The event eventDidReachThreshold is not triggered same time as the intervalStarts, but it is not counting time properly. Please if someone could help me, I want to be able to use events properly, with the amount of time which I set. Any help would be appreciated. Thanks in advance
Posted
by haris0092.
Last updated
.