I am using widget with CoreData and iCloud. They share the same App Group container. Everything works fine for a little, but spontaneously widget starts constantly reload and block itself on the device screen and in Widget Dashboard (place where you can search and add any widget).
It happens on iPhone Simulator (I use iPhone 8) and on a physical device as well. On device it behaves better, e.g., it can reload for a while and then stop.
My thoughts that it is connected to NSPersistentContainer but I'm not sure. I've tried these with no luck:
1) lazily load everything that goes with Core Data: CoreDataStack, PersistentContainer, etc.
2) use container.performBackgroundTask() to return data in getTimeline(in:completion:) faster. I have tested with only 1 record, results are the same.
3) remove everything with Core Data and put example code to show static text - that works, reloads disappear, but I need to show real data
In deferent scenarios I see these log messages:
1) -[EXSwiftUI_Subsystem beginUsing:withBundle:] unexpectedly called multiple times
2) Bogus event received by listener connection
3) [lifecycle] WARNING: Did not receive handshake message from the host after waiting ~2 seconds. THIS MAY BE A SPURIOUS LAUNCH OF THE PLUGIN due to a message to an XPC endpoint other than the main service endpoint, or the CPU is highly contended and this extension or its host is not getting enough CPU time.
and sometimes crashes with
1) signal SIGTERM
2) [NSConcreteFileHandle fileDescriptor]: unknown error
I can't figure out why it happens. I confused because it sometimes works and show my Core Data records, and reloads timeline correctly, but sometimes it goes crazy.
Any help or guidance will be appreciated.
Xcode 12.0.1 (12A7300)
Device: iPhone Xs, iOS 14.0.1