简体   繁体   中英

Using background processes in iOS with Twilio

I am developing a VoIP app using Twilio for iOS. The app should be able to receive incoming connections. For that, I have checked the VoIP and Sound capabilities so that the app keeps running and listening for ports.

To achieve this, I have initialized a TCDevice in my appDelegate and set the appDelegate to be the TCDeviceDelegate so that the system keep listening for new connections. But the app will eventually go into background, or even be terminated at some point. So what should I do at this point?

Is this the correct way for keeping the app listening even when in background? I have been reading that I need to use a setKeepAliveTimeout in my didEnterBackground method, but Apple says when using iOS8+ , we should be registering for Remote Notifications instead.

Also, I am reading the Apple documentations, and they say that sockets should be tagged properly for the system to keep these sockets alive. Does Twilio's library take care of these details?

I am very confused about the whole process. Does Twilio take care of everything? if so, how?

The Twilio SDK calls the setKeepAliveTimeout for you so you don't need to call that or worry about the sockets. All you need to do is add the two background settings to your info.plist for Playback of Audio and VOIP.

The Twilio online documentation is not that great, however if you download the iOS SDK and untar it you will find a FAQ which is NOT online that explains more. You will also find a BasicPhone Xcode project that is way more fleshed out than the Monkey project.

Also I found that unless you cough up some money then none of the calls will actually go through.

If you encounter any problems then the Twilio email support is great for the first 48 hours of each issue and then they tend to go silent. YMMV.

All of this is information I could have done with 2 months ago, hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM