IOS 5 Local Notifications While in the foreground there is a way

On iOS 5, we now have a notification bar on top for posting messages. I saw that local notifications will be executed only if the application is in the background (not sure when the queue is in the queue and / or when the notification should be triggered, accept the latter).

Is there a way to place notifications in the notification bar when the application is in the foreground?

+4
source share
2 answers

From my point of view, your application will be notified of a local notification when the application is launched in the application: the delegation method didReceiveLocalNotification, but the banner will not be displayed at the top of the device’s screen, and the entry in the Notification Center will not be placed. However, your application will be notified, and therefore you can show your own interface for notification in the application or refuse it.

The notification center is only for notifications that you missed because the application is not in the foreground and why they disappear when you open the application.

+8
source

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

Further troubleshooting steps in our chat in the chat and based on the above.

As I said, there are only two possibilities why it does not work. placement (in the case of delegating the application against another class) and the application variable. therefore, if it works as an application delegate, then I’m not sure how to allow this other, and then make a public method that you can get from the class from which you want to receive a notification. probably not the most elegant or the right way, but I don't know what else to say.
If its an application variable, then make sure that you use the same thing that I published, the application from the argument list applicationfinishloading vs [[shared application]

+1
source

Source: https://habr.com/ru/post/1402952/


All Articles