You could use the delegate of [NSApplication sharedApplication] as described above to store the revelent information rather than using preferences, and that is lost when the application closes 😉.
PS [NSApplication sharedApplication] can be accessed with the constant NSApp.