ort11
ort11

Reputation: 3349

IOS 5 Local Notifications While in Foreground, is there a way

On IOS 5, we now have the notification bar on top to put messages. I have seen that Local Notifications will only happen if the app is in the background (not sure when queued, and / or when the notification is to fire, assume the latter).

Is there any way to put notifications in the notification bar while the app is in the foreground?

Upvotes: 4

Views: 3792

Answers (2)

owen gerig
owen gerig

Reputation: 6172

Yes, local notifications work with the simulator. However, make sure you are implementing application:didreceiveLocalNotification in your app delegate if you want to see the nofication while your app is in the foreground (source)

further troubleshooting steps per our conversation in chat and based on the above.

Like i said there are only 2 possibilities of why its not working. placement (in app delegate vs another class) and the application variable. so if it works in the app delegate then im not sure how to resolve that other then making a public method that you can reach from the class you want the notification to come from. probably not the most elegant or proper way but i dont know what else to say.
If its the application variable then make sure you use the same one i posted, application from the applicationfinishloading arguments list vs [[shared application]

Upvotes: 1

W Dyson
W Dyson

Reputation: 4634

From my understanding, your app will be notified of a local notification while the app is running in the application:didReceiveLocalNotification delegate method, but a banner will not be shown at the top of the device screen, not will an entry be put in Notification Center. Your app is notified however, and this is so you can show your own UI for the notification in the app, or choose to ignore it.

Notification Center is only for notifications that you're missed because the app is not in the foreground, and that's why they disappear when the app is opened.

Upvotes: 8

Related Questions