0

I am very new to web technologies, but have been developing for iphone for 3 years. I need to send a message from a server I rent to my app. Not a "push notification" for the user, but for the app itself. How should I do this?

4

1 回答 1

3

In general, it's not possible for a server to directly contact an app running on a mobile device (since the device might be behind firewalls or NAT). Instead, the mobile device usually makes a connection to the server, and the server responds with any information available for the device.

This is basically how APNS notifications work, except that Apple has already done most of the infrastructure work for you. Push notifications take very little battery power, and since iOS can batch requests for all apps at once, each app does not need to make its own connection to a server somewhere.

If you implement this yourself, you will need to learn about a technology such as long polling. If you're very new to web technologies, you might consider getting some help making the web server side work.

于 2012-11-28T04:10:33.917 回答