ios7 每隔一小时从我的服务器以后台模式获取数据

标签 ios objective-c ios7 voip

我正在开发一个 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/

相关文章:

ios7 - 在iOS7上应该在应该开始和处理程序之间重置摇动手势转换(状态开始)

ios - 更改 UITableViewCell 上 accessoryView 的大小

ios - 用于 2D 游戏的 Unity

ios - 在 iOS 应用程序中使用 Instagram sdk 获取标记的人

uitableview - 如何在 iOS 7 中将 UITableView 添加到 UIAlertView

ios - Xcode 5 中没有圆形矩形按钮?

ios - MTKView - 一次绘制两个 View

ios - 获取当前月份和年份并传递给 API iOS Swift?

ios - Objective-C:属性类型转换的自定义 setter 警告

iphone - 在 iPhone 应用程序中实现 Reddit、StumbleUpon、del.icio.us 和 Digg