GCDAsyncSocket background VOIP

前端 未结 2 577
一向
一向 2021-02-04 21:59

I\'m trying to implement this(Configuring Sockets for VoIP Usage) using this(CocoaAsyncSocket). To the best of my knowledge step 1 I have done, adding VOIP to background servic

2条回答
  •  粉色の甜心
    2021-02-04 22:35

    I realise this is an old question now - but you should call

     BOOL backgroundAccepted = [[UIApplication sharedApplication] setKeepAliveTimeout:600 handler:^{ [self backgroundHandler]; }];
     if (backgroundAccepted)
     {
          NSLog(@"VOIP backgrounding accepted");
     }
    

    On app startup and use it all the time - the reason is, as you'll discover, is when the app is foregrounded, but the screen is LOCKED you don't receive the didEnterBackground call, and your app will be put to sleep 10-15 mins after the screen has locked, even though you are foregrounded

提交回复
热议问题