I need to get the users sex when my application starts up.
How do I call the code only when the application first starts up? I just want to display an alert view with a simple “Are you Male or Female?” and then store the selection for use throughout the rest of the application. I don’t want the user to be asked every time they open the app, just the first time they open it.
Thanks,
Jack
EDIT
I know how to actually store the data, but where do I call the code so the alert view is only displayed when the application loads up?
Edit
You could place this so that is get’s called in
Sounds like a good use for
NSUserDefaults. It depends how you want to store that information for example if I was to use a string (I’ve chosen string as detecting whether no value is already set is easier than usingint) I could have something like this on start upThen when a user has selected their sex you can save it with something like: