I have this block of code in my project and whenever I build to a < iOS 14.0 it crashes causing the error below
if #available(iOS 14.0, *) {
if shouldAlertWidgetCenter {
WidgetCenter.shared.reloadAllTimelines()
}
}
If I comment out the one line
WidgetCenter.shared.reloadAllTimelines()
Then it runs fine even though it is in the #available check and shouldn't make any difference.
I tried putting the import inside of the canImport block and still crashes unless that line is commented out
#if canImport(WidgetKit)
import WidgetKit
#endif
I'm drawing a blank at what I'm doing wrong. Thanks a lot if anyone has any ideas
Crash Log:
dyld: Library not loaded: /System/Library/Frameworks/WidgetKit.framework/WidgetKit
Referenced from: /private/var/containers/Bundle/Application/60E4FB21-B28D-4E44-8972-0370BEB6DAE8/_.app/__
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
(lldb)