我得到一个VOIP套接字在iOS应用程序的后台运行。 我的连接工作正常,但当我的应用程序进入后台时,它不会醒来。 如果我打开应用程序,它会响应它在睡觉时收到的任何消息。 我build立了这样的stream: CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (CFStringRef) @"test.iusealocaltestserver.com", 5060, &myReadStream, &myWriteStream); CFReadStreamSetProperty ( myReadStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP ); CFSocketNativeHandle native; CFDataRef nativeProp = CFReadStreamCopyProperty(myReadStream, kCFStreamPropertySocketNativeHandle); CFDataGetBytes(nativeProp, CFRangeMake(0, CFDataGetLength(nativeProp)), (UInt8 *)&native); CFRelease(nativeProp); CFSocketRef theSocket = CFSocketCreateWithNative(kCFAllocatorDefault, native, 0, NULL, NULL); CFSocketGetContext(theSocket,&theContext); CFOptionFlags readStreamEvents = kCFStreamEventHasBytesAvailable | kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered | kCFStreamEventOpenCompleted; CFReadStreamSetClient(myReadStream, readStreamEvents, (CFReadStreamClientCallBack)&MyCFReadStreamCallback, (CFStreamClientContext *)(&theContext)); CFReadStreamScheduleWithRunLoop(myReadStream, CFRunLoopGetCurrent(), […]