Reputation: 656
From time to time widget crashing with "unable to load" error. Is anyone know how to fix it? Widget haven't requests to server or smth else.
Upvotes: 26
Views: 13737
Reputation: 183
In my case NotificationCenter.framework
was accidentally deleted from Link Binary With Libraries
in Build Phases
tab in widget target.
Upvotes: 0
Reputation: 588
Set this in viewDidLoad
:
extensionContext?.widgetLargestAvailableDisplayMode = .expanded
Upvotes: 0
Reputation: 14925
I have built a today-widget similar to Building a Simple Widget for the Today View.
I had none of the above issues. Mine was 0 row (I had no data for this particular day and hence, 0 row). I did not expect that it could be the problem since in the main-app, you can have empty table-view.
If you see unable to load
message, make sure you have at least 1 row.
Upvotes: 0
Reputation: 880
I have faced the same issue where it wasn't showing anything. Even my debug option was not working. I found an article online which helped me a lot. I would like to recommend this here.
Most of the time it is the size of the content view that crashes the widget. in that case, use this code snippet in TodayViewController.
Code snippet
override func viewWillAppear(_ animated: Bool)
{
var currentSize: CGSize = self.preferredContentSize
currentSize.height = 200.0
self.preferredContentSize = currentSize
}
Link for further research.
Upvotes: 1
Reputation: 24341
Unable to load in today extension mostly appears when:
Debug your app extension to find out the exact problem.
Refer to Xcode's Debug Gauge for Memory and CPU utilization.
Edit:
Debugging today extension
You can debug your extension the same way you debug your main project. Just select that particular target scheme
in your Xcode and run the project.
Now try using the breakpoints and other print statements in the extension’s code and you are good to go. Happy coding..😊
Upvotes: 34
Reputation: 2072
I have faced this error I used a custom view. But forgot to check Is initial viewController. Set an entry point form "show attribute inspector" as an initial view controller
Upvotes: 1