I have a set of Widgets that work flawlessly on Xcode 14 and iOS 16, both on Simulator and Device. With Xcode 15 beta (4), these widgets simply don't show up anymore on the iOS 17 Simulator, and I feel like I've tried everything.
Building with the new Xcode 15 beta on any iOS 16 or 15 simulator works fine and the widgets are available. They're just gone on iOS 17.0.
When I add a new widget extension it shows up immediately on the iOS 17 simulator. I've compared every single line on the Build Settings but couldn't find any difference there.
I have also updated the SiriKit Intent to an AppIntent with no success.
Anyone experiencing the same issue? Or any clue on what I could have missed?
I could resolve this by making sure the intent is running on the main thread. With iOS 17 it seems the intent code can now run directly in the app and on the widget extension.
For me the extension seems to have crashed because it was running the code in the app instead of the extension. Some parts of my code are a bit old and need to run on the main thread. The EntityQuery is running on a background thread though so I changed this and it's working again in my case.
struct DataAppEntityQuery: EntityQuery {
func entities(for identifiers: [DataAppEntity.ID]) async throws -> [DataAppEntity] {
let data = await retrieveData().filter { identifiers.contains($0.id) }
return data
}
func suggestedEntities() async throws -> [DataAppEntity] {
return await retrieveData()
}
func defaultResult() async -> DataAppEntity? {
try? await suggestedEntities().first
}
func retrieveData() async -> [DataAppEntity] {
//code that needs to run on the main thread in my case
await MainActor.run {
//....
return data
}
}
}
Also it seems that in my case the simulator uses way more memory than the real device. This makes testing on the simulator a bit useless because it runs out of memory and fails the widget where the device only uses some 13 MB.