VoIP Pushes

**Download iOS8 SDK

In iOS8 Apple introduced PushKit, and a new type of push notifications, known as VoIP pushes. Such pushes provide additional functionality on top of the standard push that allows the app to execute code before displaying a notification to the user.

**IMPORTANT:** You cannot create a VoIP certificate in development mode, **only production**. Therefore, in Pushwoosh iOS app configuration **you should always use Production gateway for VoIP certificates.**
1. In your **AppDelegate.h** import PushKit framework, add `PKPushRegistryDelegate` protocol and create the `PKPushRegistry` property:
#import @interface AppDelegate : UIResponder @property (nonatomic, strong) PKPushRegistry* voipRegistry;
**2.** In `- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {` add:
// handling push on app start [[PushNotificationManager pushManager] handlePushReceived:launchOptions]; // make sure we count app open in Pushwoosh stats [[PushNotificationManager pushManager] sendAppOpen]; // register for push notifications! [[PushNotificationManager pushManager] registerForPushNotifications]; _voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()]; _voipRegistry.delegate = self; _voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
**3.** Add the following methods to your `AppDelegate` class:
- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(NSString *)type { //unsubscribe from push notifications [[PushNotificationManager pushManager] unregisterForPushNotifications]; } - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type { //push received [[PushNotificationManager pushManager] handlePushReceived:payload.dictionaryPayload]; } - (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type { [[PushNotificationManager pushManager] handlePushRegistration:credentials.token]; }
**4.** Enable **Voice over IP** in the Background Modes:

PushNotificationsApp_xcodeproj

5. Upload your VoIP certificate to Pushwoosh Control Panel according to the Configuration Guide, and choose the Production gateway.

That’s it!
Note that opposed to standard push, VoIP pushes do not play a notification sound nor display an alert. However, they wake up your app in the background, which allows you to schedule a local notification.