Search code examples
iosios4uialertviewuidatepicker

Showing an alert/notification in Iphone at a particular time(set by either user or developer)


I would like to know what IOS functionality to use to enable me to display a alert/notification at a particular time on the iphone. The time would be set either by the user or the developer using the UIDatePicker. Running the Local Notification Tutorial, the alert/notification is getting displayed only when the app is in the background(please correct me if I am wrong)

It would be great if someone could help me out with this.


Solution

  • So I think you're on the right track here: not sure what more I can add.

    You can use a local notification to display an alert at any given time. As you see from the tutorial, notifications aren't triggered when your app is in the foreground.

    But there's nothing to stop you from writing code in your app to alert users at the time the notification is required when your app is in the foreground: and this is probably more ideal. You may want to take advantage of the UI options offered to you when in the foreground to do something different, or you could just display your own UIAlertView.