Instance Method

setKeepAliveTimeout:handler:

Configures a periodic handler for VoIP apps in older versions of iOS.

Declaration

- (BOOL)setKeepAliveTimeout:(NSTimeInterval)timeout handler:(void (^)(void))keepAliveHandler;

Parameters

timeout

The maximum interval (measured in seconds) at which your app should be woken up to check its VoIP connection. The minimum acceptable timeout value is 600 seconds.

keepAliveHandler

A block that performs the tasks needed to maintain your VoIP network connection. Setting this parameter to nil releases the current handler block and prevents UIKit from scheduling the next wake.

Return Value

YES if the handler was installed or NO if it was not.

Discussion

In iOS 8 and later, voice-over-IP (VoIP) apps register for registerForRemoteNotifications remote notifications instead of using this method. Using remote notifications eliminates the need for a timeout handler to check in with the VoIP service. Instead, when a calls arrives for the user, the VoIP service sends a VoIP remote notification to the user’s device. Upon receiving this notification, the device launches or wakes the app as needed so that it can handle the incoming call.

In iOS 7 and earlier, VoIP apps use this method to install a handler whose job is to maintain the app’s network connection with a VoIP server. This handler is guaranteed to be called before the specified timeout value but may be called at a slightly different time interval in order to better align execution of your handler with other system tasks, and thereby save power. Your handler has a maximum of 10 seconds to perform any needed tasks and exit. If it does not exit before time expires, the app is suspended.

Timeout values and handlers are not persisted between app launches. Therefore, if your app is terminated for any reason, you must reinstall the handler during the next launch cycle.

For calls to this method to succeed, the app must have the voip value in the array associated with the UIBackgroundModes key in its Info.plist file. Calling this method replaces the previously installed handler and timeout values, if any.

See Also

Deprecated Symbols

- registerUserNotificationSettings:

Registers your preferred options for notifying the user.

Deprecated
currentUserNotificationSettings

Returns the user notification settings for the app.

Deprecated
UIRemoteNotificationType

Constants indicating the types of notifications the app may display to the user.

Deprecated
- openURL:

Attempts to open the resource at the specified URL.

Deprecated
- scheduleLocalNotification:

Schedules a local notification for delivery at its encapsulated date and time.

Deprecated
- presentLocalNotificationNow:

Presents a local notification immediately.

Deprecated
- cancelLocalNotification:

Cancels the delivery of the specified scheduled local notification.

Deprecated
- cancelAllLocalNotifications

Cancels the delivery of all scheduled local notifications.

Deprecated
scheduledLocalNotifications

All currently scheduled local notifications.

Deprecated
- setNewsstandIconImage:

Sets the icon of a Newsstand app to an image depicting the current issue of a publication.

Deprecated
- clearKeepAliveTimeout

Removes a previously installed periodic handler block.

Deprecated
- setStatusBarHidden:withAnimation:

Hides or shows the status bar, optionally animating the transition.

Deprecated
statusBarHidden

A Boolean value that determines whether the status bar is hidden.

Deprecated
- setStatusBarStyle:animated:

Sets the style of the status bar, optionally animating the transition to the new style.

Deprecated
statusBarStyle

The current style of the status bar.

Deprecated
- setStatusBarOrientation:animated:

Sets the app's status bar to the specified orientation, optionally animating the transition.

Deprecated
statusBarOrientation

The current orientation of the app's status bar.

Deprecated
- registerForRemoteNotificationTypes:

Register to receive remote notifications of the specified types via Apple Push Notification service.

Deprecated
- enabledRemoteNotificationTypes

Returns the types of notifications the app accepts.

Deprecated
proximitySensingEnabled

A Boolean value that determines whether proximity sensing is enabled.

Deprecated
- setStatusBarHidden:animated:

Hides or shows the status bar, optionally animating the transition.

Deprecated