Hey,
I am trying to create an iOS App for multiple versions, but i need to refresh my widget with WidgetCenter.shared.reloadAllTimelines() after I added a new data entry inside of my main app.
I dont know why, but this doesnt work for me, (the app crashes) so I tried to use NotificationCenter.
After I realized that NotificationCenter can't communicate between the main app and an extension, I tried to use UserDefaults.
But this doesnt work for me as well.
Pls help me I'm desperate.
I am trying to create an iOS App for multiple versions, but i need to refresh my widget with WidgetCenter.shared.reloadAllTimelines() after I added a new data entry inside of my main app.
I dont know why, but this doesnt work for me, (the app crashes) so I tried to use NotificationCenter.
After I realized that NotificationCenter can't communicate between the main app and an extension, I tried to use UserDefaults.
But this doesnt work for me as well.
Pls help me I'm desperate.
Hi,
I already solved my Problem.
WidgetKit should be ignored by older versions, so it shouldnt matter if I am calling
WidgetCenter.shared.reloadAllTimelines() without #available condition.
The problem was, that the WidgetKit framework was not marked as optional BUT NOT the framework inside the widget extension!
You need to add the framework manually to your main app, and than mark this one as optional.
I already solved my Problem.
WidgetKit should be ignored by older versions, so it shouldnt matter if I am calling
WidgetCenter.shared.reloadAllTimelines() without #available condition.
The problem was, that the WidgetKit framework was not marked as optional BUT NOT the framework inside the widget extension!
You need to add the framework manually to your main app, and than mark this one as optional.