If you want to be able to receive data while the app is not in the foreground, you will need to use Apple's push notification feature, which is implemented in hardware and the only way to make network connections to a device that is in power saving mode.
There's plenty of documentation how it works, basically the device registers with your server (after asking the user for permission), you use the token it gives you to send a ping to Apple's server, which forwards the ping on to the device. The device can then contact your server and download the actual data you want to send to it.
If you're OK with the server only communicating with your app while the app is running, you have a few options. The easiest is "long polling" where the app sends a HTTP request to the server, using something like this:
NSURL *serverUrl = [NSURL URLWithString:@"http://example.com/"];
NSString *response = [NSString stringWithContentsOfURL:serverUrl usedEncoding:NULL error:NULL];
NSLog(@"%@", response);
Instead of the server responding instantly, it can wait around for a long time (for example 45 seconds) until it has something to send to the device, then it responds with the information.
If 45 seconds are reached without having anything to send, it just sends a nothing response and the phone immediately opens up a new URL request to the same URL. This keeps the server from having a bunch of old/abandoned connections open. Typically connections are dropped after 60 seconds, so you want to respond before that time limit is reached. Obviously you'll want to do the request on a background queue with NSOperationQueue
.
There are other options, you could use sockets, you could start a web server on a custom HTTP port on the phone (eg: https://github.com/robbiehanson/CocoaHTTPServer). But long polling is often the easiest choice.
Most apps use a combination of push notifications and something else.