2

I am working on an app, which is available to receive notifications from server. I used UILocalNotification, and my app can receive informations from server with foreground and background mode, but I don't know how my app can do it when it is killed by user. In fact, I know that Facebook message app can do it easily, we always receive notifications any time. Please, give me some solutions, thanks so much.

Nirav D
  • 71,513
  • 12
  • 161
  • 183

2 Answers2

1

plz read this link

https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html

push notifications payload look like this

{
    "aps": {
         "badge": 10,
         "alert": "Hello world!",
         "sound": "Default"
    }
}

if you add message in alert. then your notification will show when your app in background or killed.

balkaran singh
  • 2,754
  • 1
  • 17
  • 32
0

Read this link for all the steps which you have required to setup the push notification : https://www.raywenderlich.com/123862/push-notifications-tutorial

Bhadresh Mulsaniya
  • 2,610
  • 1
  • 12
  • 25
  • thank you, this link is useful for me. But when I read it, I also can not complete way how to send notifications to Apple Push Notification Sevices :(( – Minh Hoàng Jul 12 '16 at 04:23
  • You stuck anywhere? – Bhadresh Mulsaniya Jul 12 '16 at 05:30
  • ok, I found out the way to handle the trouble. I read this link and customize .php file there and I also create a server which manager all notifications I wanna send to app (when, what be send, how to send to android app and iOS app together...) :)) Moreover, someone also use Firebase library (Google cloud message) to do it. :)) – Minh Hoàng Aug 01 '16 at 07:59