can i implement an app that have 2 types of notification (Remote and newsstand notification)

蓝咒 提交于 2019-12-06 15:51:56

问题


i need to know if i can implement an app that can handle 2 types of notifications

Thanks


回答1:


Both remote and local notifications enable an application to inform its users that it has something (information) for them - in a form of a notification (It could be a message, an impending calendar event, or new data on a remote server), when the application isn't running in the foreground.

When presented by the operating system, local and push notifications look and sound the same. They can display an alert message or they can badge the application icon. They can also play a sound when the alert or badge number is shown.

The difference between the two are:

  • Local notifications are scheduled by an application and delivered by iOS on the same device. Local notifications are available in iOS only.
  • Push notifications, also known as remote notifications, are sent by an application’s remote server (its provider) to Apple Push Notification service, which pushes the notification to devices on which the application is installed. Push notifications are available in both iOS and, beginning with Mac OS X v10.7 (Lion), Mac OS X.

Going back to your question, the answer is YES.

As per discussed in the Apple documentation:

To have iOS deliver a local notification at a later time, an application creates a UILocalNotification object, assigns it a delivery date and time, specifies presentation details, and schedules it. To receive push notifications, an application must register to receive the notifications and then pass to its provider a device token it gets from the operating system.

When the operating system delivers a local notification (iOS only) or push notification (iOS or Mac OS X) and the target application is not running in the foreground, it presents the notification (alert, icon badge number, sound). If there is a notification alert and the user taps or clicks the action button (or moves the action slider), the application launches and calls a method to pass in the local-notification object or remote-notification payload. If the application is running in the foreground when the notification is delivered, the application delegate receives a local or push notification.

For further understanding, read more about Local and Push Notifications.



来源:https://stackoverflow.com/questions/10897837/can-i-implement-an-app-that-have-2-types-of-notification-remote-and-newsstand-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!