public struct TestWidget: Widget {
let kind: String = "TestWidget"
public init() {}
public var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: WidgetProvider()) { entry in
if #available(iOSApplicationExtension 17.0, *) {
widgetView()
.containerBackground(for: .widget) {
Color(.black)
}
}
else {
widgetView()
}
}
.configurationDisplayName("")
.description("")
.supportedFamilies([.systemMedium])
}
private func widgetView() -> some View {
Text("TEST")
}
}
Add this widget to the home screen.
Click this widget, app will launch.
The app will crash immediately at the location shown in these screenshots:
At the moment, it appears that this issue cannot be reproduced on other devices. It is yet to be determined whether it is related to the OS environment.
Steps:
Create a widget code like this:
Add this widget to the home screen.
Click this widget, app will launch.
The app will crash immediately at the location shown in these screenshots:
At the moment, it appears that this issue cannot be reproduced on other devices. It is yet to be determined whether it is related to the OS environment.
Environment