Keep alive UDP socket in background for ios

2019-07-20 19:57发布

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.

enter image description here

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. enter image description here

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

0条回答
登录 后发表回答