iphoneiosobjective-ccocoa-touchcfrunloop

How to do socket operation when application entered background?


We are working on conference related application, Is it possible to send and receive packets through socket, after the application entered background? I have googled and found some way like below....

eg: 

UIApplication *uiApplication = [UIApplication sharedApplication];

backGroundTask = [uiApplication beginBackgroundTaskWithExpirationHandler:^{
    CFRunLoopRun();
  }];

What CFRunLoopRun is doing here. If it will work.. How? I am not clear. Help me where to go from here...

thanx.


Solution

  • It will start a thread's run loop, which waits for inputs like timers and touch events. Someone thought they could be clever and force the system to keep running in the background here but this is likely just going to get the application killed by the OS. – borrrden