HomeiOS Developmentios - In the present day widget information not exhibiting after take...

ios – In the present day widget information not exhibiting after take away and once more add


I’ve applied 3 widgets in my app; customers can add and take away widgets as fits customers.
however on some units, when a person removes the widget from the app after which provides it once more
the widget would not present any information or view till widget will get new information.
I’ve referred to as API and up to date information in viewwillappear in order that preliminary information will probably be proven.

So as to add a widget:

if let match1 = scoreDtailsViewModel.matchDetails?.match {
UserDefaults.init(suiteName: Constants.widget1KEY)?.setValue(strive! PropertyListEncoder().encode(match1) , forKey: "match")
}
if let liveMarket = scoreDtailsViewModel.liveMarket.first {
UserDefaults.init(suiteName: Constants.widget1KEY)?.setValue(strive! PropertyListEncoder().encode(liveMarket) , forKey: "liveMarket")
}
if let id = scoreDtailsViewModel.match?.id {
UserDefaults.init(suiteName: Constants.widget1KEY)?.setValue( id, forKey: "match_id")
}
DispatchQueue.fundamental.async(execute: {
NCWidgetController().setHasContent(true, forWidgetWithBundleIdentifier: Constants.widget1BundleIdentifier)
})

To take away the widget:

UserDefaults.init(suiteName: Constants.widget1KEY)?.setValue("" , forKey: "match")
UserDefaults.init(suiteName: Constants.widget1KEY)?.setValue("" , forKey: "liveMarket")
UserDefaults.init(suiteName: Constants.widget1KEY)?.setValue("", forKey: "match_id")
DispatchQueue.fundamental.async(execute: {
NCWidgetController().setHasContent(false, forWidgetWithBundleIdentifier: Constants.widget1BundleIdentifier)
})

The way it takes care of studying:

enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments