2

I've use GCDAsyncSocket to implement telnet protocol parser. Recently, I found that if the app enter background, it will be no longer able to read or write data any more.

I've enabled background function of GCDAsyncSocket:

__weak typeof(self) weakSelf = self;
[sender performBlock:^{
    NSLog(@"Enable backgrounding on socket, result: %d", [sender enableBackgroundingOnSocket]);
    [weakSelf read];
}];

But it doesn't work. When I press home button and enter background, the the data transmission stopped, which continues when the app become active again. Am I use it in a wrong way?

Hubert Wang
  • 502
  • 5
  • 17

0 Answers0