我想你可以在應用程序在後臺運行時設置本地通知,並通過通知指示用戶有來電。當用戶進入應用程序時,您可以顯示來電。
在下面的鏈接,查看 Background Execution and Multitasking and also Scheduling the Delivery of Local Notifications
IE,因爲你已經設置你的Info.plist的UIBackgroundModes鍵,您的應用程序將支持長時間運行的任務。因此,在applicationDidEnterBackground方法中添加一個方法,在有呼叫時創建一個UILocalNotification。 UILocalNotifications通知用戶警報消息和您選擇的語氣。因此,一旦用戶收到通知並且用戶進入該應用程序,該應用程序將前臺前往,您可以在其中添加該方法以接收該呼叫。
在LocalNotification的警報主體中,您可以將來電者的信息發送給用戶。
編輯:Check out the answer of Paul Richter in this link,他說
VOIP mode gives you the ability to have code running to notify you of a call coming in
but you're not going to be able to record audio from the background. If you look at how
Voip apps work, when a call comes in a Local Notification is sent informing the user
that a call is coming in. The User then must accept the call which will bring the
application to the foreground at which point from the audio side of things you can
activate your session and proceed with the phone call.
雖然不能完全與您所使用的圖書館,他給了過程的一個體面的交代。
希望這會有所幫助。
嗨,請通過http://stackoverflow.com/questions/6601536/ios-voip-socket-will-not-run-in-background?rq=1這篇文章也可能對你有所幫助。 – User97693321
你的意思是。你需要一種方法讓應用程序在後臺運行,以便在有電話時表明你? –
btw ...你使用哪個版本的pjsip?你也使用zrtp? –