-->

Keep alive UDP socket in background for ios

2019-07-20 20:08发布

问题:

My question is not actually what is the code to keep UDP socket alive when application in background but a confusion about the documentation in apple developer site.

According to apple developer guide if i set kCFStreamNetworkServiceType to kCFStreamNetworkServiceTypeVoIP then this socket will be managed specially by system when app in background.

In CocoaAsyncSocket library they reported that this settings is not working in UDP socket but only in TCP socket. I also tested this option for native CFReadSteam interface but socket didn't alive when app was in background. But apple developer site never mention it.

Is this true that only tcp socket can keep alive in background or i am making any mistake in my code?