I'm writing code to a new iOS 8 Today widget, but I noticed that each time that widgetPerformUpdateWithCompletionHandler:
is called my ivars (created from @property
) are reset. It's is like every time a new view controller is getting instantiated.
This makes it impossible to save data on memory between updates to the widget (while it is in the background, for example, and is called to update its content).
Is this normal behaviour, or a bug? Should I save my simple numbers to NSUserDefaults
instead of relying on memory based data, which is being reset?