我正在开发一个 iPhone 应用程序,它可以使用 VOIP 从我的应用程序中调用电话。为此,我必须每隔一小时连接一次服务器以注册我的设备并使其随时可用于来电。但是在 iOS7 中,即使它处于后台模式,如何每隔一小时连接一次我的服务器。任何帮助将不胜感激。
谢谢, 吉润
iOS App programming guide中有具体信息关于实现 VoIP 应用程序 -
To configure a VoIP app, you must do the following:
Enable support for Voice over IP from the Background modes section of the Capabilities tab in your Xcode project. (You can also enable this support by including the
UIBackgroundModes
key with the voip value in your app’s Info.plist file.)Configure one of the app’s sockets for VoIP usage.
Before moving to the background, call the
setKeepAliveTimeout:handler:
method to install a handler to be executed periodically. Your app can use this handler to maintain its service connection.Configure your audio session to handle transitions to and from active use.
一旦您的套接字配置为使用 VoIP,iOS 将在后台为您管理它,使其保持事件状态并在有流量时通知您的应用
关于ios7每隔一小时从我的服务器以后台模式获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23992138/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |