NSUserActivity has a method setNeedsSave:.
[userActivity setNeedsSave:YES];
Unfortunately it doesn't save at once, but just tells a user activity object that it should be saved in the future. In case of a crash the state may not be saved. As a result the state may not be restored after a crash.
Does any workaround exist? Is it possible to implement the method save for NSUserActivity myself in a category to force it to save each time when the state updates, not only when the system decides to do saving?