views:

609

answers:

1

i want to know how do i enable my application to use push notification service.i read the guide but doesn't find it much detailed information about it.Could someone tell me an easy way that how it works,what are the requirements,how do i apply this in my app. one thing i would like to know that according to guide the connection between provider and APNs must be asynchronous,What does it mean? also i read that if we continuously connect and disconnect APNs will block the IP. so what is the minimum time difference to connect to APNs after disconnecting.Please guide me in according to the question.thanks

+2  A: 

First off, there are quite a few tutorials out on the net for how to do this.

But here's the basics:

  1. You need a server that is able to connect to the APNs whenever you have notifications for your app.
  2. That server will then connect to the APNs using your Apple supplied SSL cert.
  3. For each messages that you have to send:
         a. Create a payload message that your app can do something with.
         b. Include the deviceToken for the iPhone you want to send notifications to.
         c. Write the raw data (see Apple's docs for specifics on the format) to the socket for each message.
  4. Disconnect from the APNs.

What Apple means by "asynchronous", is that the APNs will not send a response to any of your data acknowledging it. So you need to make sure that whatever networking library you're using to connect can support raw data connections.

I don't think I have seen any published guidelines for minimum time between connections. I think Apple's note is more specifically directed to ensure that you're batching your messages and not flooding the APNs maliciously. I suspect that they'll contact you first if they feel you're overstepping the bounds.

Again, I would suggest a quick Google search on "iphone push notification tutorial" for specifics that can guide you further.

Hope this helps you on your way.

Michael Lamb