IOS Development: Push notifications prevent my local notifications from firing

I have an application for an alarm clock that is designed to work in a certain way when it is running in the foreground, and receives a local notification that was planned by my application. When a user sets an alarm, my application creates a local notification. When this local notification fires, it calls the methoddidReceiveLocalNotificationto alert the user. The problem is that if my application is running in the foreground and the push notification comes from another application, then it displays the type of modal push notification notification, which prevents my application from warning the user when a local notification occurs. As soon as I reject the textual representation of the push notification, my application launches a local notification. Is there any way around this? I ask, because if my application does not turn off the alarm when the user plans to start it, then it just hits the whole purpose of setting the alarm.

Thank you very much for your wisdom!

+3
source share
2 answers

There are 5 different states for an application:

  • Foreground Active
  • Foreground
  • Backgroung Running
  • Backgroung Suspended

, "Foreground Active", , push-, "Foreground Inactive".

Apple (http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html):

, , , - , UILocalNotification. , , ; : didReceiveLocalNotification: , .

, application:didReceiveLocalNotification: , si , .

.

+4

, . , , push-, , . , ?

+1

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