I'm in between with my widget development. As we have already placed our app with widget integration. But in now a days, I'm facing problem with today's widget in iOS. I've written a code for two cases. First time when widget is initially loading first time with application launch it calls web-service and fetches data over the internet and then We store them into user default for later use.
Now when next time, user pull down the notification menu, we display our old stored content first to user and then we fetch it from web-service and store in user-default and then reloading table once again.
For above operation, I'm facing content size issue for table, flickering issue and "unable to load" message in some cases.
Now take a look for below code, I'm making a web-call in below method and after the response of web-service, I just handle completion handler.
- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {
// Perform any setup necessary in order to update the view.
// If an error is encountered, use NCUpdateResultFailed
// If there's no update required, use NCUpdateResultNoData
// If there's an update, use NCUpdateResultNewData
[self getBookedAppointmentsNew:completionHandler];
}
So, please share your experience and ideas with me.
In general I saw the "Unable to load" message whenever there was a crash in the widget. The widget tries to load itself and if it repeatedly crashes then it will just show the "Unable to load" message. Debug your widget and make sure nothing is causing it to crash