views:

466

answers:

2

I want to allow the user to enter a valid date using the iPhone’s settings application.

I have experimented with many of the PreferenceSpecifiers data node types including date.

I have two issues:

  1. When I specify date as the type, my app within the settings app crashes. Working examples would be greatly appreciated.

  2. Since this approach hasn’t worked for me yet, will I programmatically be able to validate the date that the user enters?

+1  A: 

The answer to number 2 is no. The only time you can validate the data entered is the next time your app is launched. None of your app's code is run via the Settings app.

You might consider pulling this setting into your app.

Patrick Burleson
A: 

Have you read this guide and this section of the App guide? They describe in detail how the settings like this work.

You won't be able to validate anything a user sets through the Settings application. Also, I don't see Date as a valid setting type anywhere, so I don't even think this is possible through the Settings application.

I would simply create a settings view within the application. That way you can control your custom logic as you see fit.

Ben S