Exercise Report Extension crashes when including 3 or extra stories on one display screen.
I am attempting to make use of the brand new Display screen Time API from WWDC 2021 and 2022
I am attempting to indicate 3 stories on one display screen, I created a easy SwiftUI app to reveal the problem the place only a Textual content for every report is displayed. All of them seem for a couple of seconds after which disappear with an error within the debug console. Our challenge is caught as a result of having 1 gadget exercise report for all components leads to poor efficiency. The entire API appears laggy, however I am questioning if it is a difficulty on my aspect or Apple’s bug.
Display screen Recording
https://drive.google.com/file/d/1DniOo4QN5bY56sddZJvLTKtkGLQugXRi/view?usp=share_link
I am getting the next error within the Xcode debug console
2023-09-02 22:36:37.763861-0400 TestApp3[6222:368344] [default] VS terminated with error: Error Area=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
All targets and the challenge have Deployment Goal iOS 16, I am utilizing XCode 14.3.1, and testing on iPhone 11 iOS 16.6
ContentView.swift
struct ContentView: View {
var physique: some View {
VStack {
DeviceActivityReport(.init("Whole Activity1"))
Spacer(minLength: 16)
DeviceActivityReport(.init("Whole Activity2"))
Spacer(minLength: 16)
DeviceActivityReport(.init("Whole Activity3"))
}
}
}
ActivityReport.swift
@major
struct ActivityReport: DeviceActivityReportExtension {
var physique: some DeviceActivityReportScene {
TotalActivityReport1 { totalActivity in
.init(totalActivity: totalActivity)
}
TotalActivityReport2 { totalActivity in
.init(totalActivity: totalActivity)
}
TotalActivityReport3 { totalActivity in
.init(totalActivity: totalActivity)
}
}
}
TotalActivityReport.swift
extension DeviceActivityReport.Context {
static let totalActivity1 = Self("Whole Activity1")
static let totalActivity2 = Self("Whole Activity2")
static let totalActivity3 = Self("Whole Activity3")
}
struct TotalActivityReport1: DeviceActivityReportScene {
let context: DeviceActivityReport.Context = .totalActivity1
let content material: (String) -> TotalActivityView1
func makeConfiguration(representing information: DeviceActivityResults<DeviceActivityData>) async -> String {
"Test1"
}
}
struct TotalActivityReport2: DeviceActivityReportScene {
let context: DeviceActivityReport.Context = .totalActivity2
let content material: (String) -> TotalActivityView2
func makeConfiguration(representing information: DeviceActivityResults<DeviceActivityData>) async -> String {
"Test2"
}
}
struct TotalActivityReport3: DeviceActivityReportScene {
let context: DeviceActivityReport.Context = .totalActivity3
let content material: (String) -> TotalActivityView3
func makeConfiguration(representing information: DeviceActivityResults<DeviceActivityData>) async -> String {
"Test3"
}
}
TotalActivityView.swift
struct TotalActivityView1: View {
let totalActivity: String
var physique: some View {
Textual content(totalActivity)
}
}
struct TotalActivityView2: View {
let totalActivity: String
var physique: some View {
Textual content(totalActivity)
}
}
struct TotalActivityView3: View {
let totalActivity: String
var physique: some View {
Textual content(totalActivity)
}
}