title: Pushkit with Sinch VOIP not working with pushkit
body: <p>I am trying to implement App-to-App calling with Sinch in my IOS app. I have implemented Pushkit in my iOS app with Sinch but the push notification is not working when the app is in background. </p>
  
  <p><strong>I have two questions.</strong> </p>
  
  <ol>
  <li><p>Do I need another web service to send push notification to my app for incoming app separately or Sinch handles it itself. </p></li>
  <li><p>If it does handle itself then what am I missing in my code. </p></li>
  </ol>
  
  <p></p>
  
  <pre><code>#import "AppDelegate.h"
  @interface AppDelegate ()
  @end
  
  @implementation AppDelegate
  
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
      [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
  
      [self handleLocalNotification:[launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]];
  
      self.push = [Sinch managedPushWithAPSEnvironment:SINAPSEnvironmentAutomatic];
      self.push.delegate = self;
      [self.push setDesiredPushTypeAutomatically];
  
      [self.push registerUserNotificationSettings];
  
      return YES;
   }
   - (BOOL)application:(UIApplication *)app
          openURL:(NSURL *)url
          options:(NSDictionary *)options {
      return [[GIDSignIn sharedInstance] handleURL:url
                             sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                    annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
    }
  
  - (BOOL)application:(UIApplication *)application
          openURL:(NSURL *)url
    sourceApplication:(NSString *)sourceApplication
       annotation:(id)annotation {
      return [[GIDSignIn sharedInstance] handleURL:url
                             sourceApplication:sourceApplication
                                    annotation:annotation];
  }
  
  - (id&lt;SINClient&gt;)client {
     return _sinchClient;
  }
  -(void)clientDidFail:(id&lt;SINClient&gt;)client error:(NSError *)error{
  
     NSLog(@"fail");
  }
  
  -(void)clientDidStart:(id&lt;SINClient&gt;)client{
  
      NSLog(@"Start");
      [self voipRegistration];
  }
  
  
  - (void)client:(id&lt;SINClient&gt;)client
     logMessage:(NSString *)message
        area:(NSString *)area
      severity:(SINLogSeverity)severity
     timestamp:(NSDate *)timestamp {
  // If you want all messages remove the if statement
  
      if (severity == SINLogSeverityCritical) {
          NSLog(@"%@", message);
      }
  }
  
  - (void)initSinchClientWithUserId:(NSString *)userId {
      if (!_sinchClient) {
  
          _sinchClient = [Sinch clientWithApplicationKey:@"&lt;my-key&gt;"
                                  applicationSecret:@"&lt;my-secret&gt;"
                                    environmentHost:@"sandbox.sinch.com"
                                             userId:userId];
  
          _sinchClient.delegate = self;
  
          [_sinchClient setSupportCalling:YES];
          [_sinchClient startListeningOnActiveConnection];
          [_sinchClient enableManagedPushNotifications];
          [_sinchClient start];
      }
   }
   - (void)handleLocalNotification:(UILocalNotification *)notification {
      if (notification) {
          id&lt;SINNotificationResult&gt; result = [self.sinchClient      relayLocalNotification:notification];
          if ([result isCall] &amp;&amp; [[result callResult] isTimedOut]) {
              UIAlertView *alert = [[UIAlertView alloc]
                                    initWithTitle:@"Missed call"
                                    message:[NSString stringWithFormat:@"Missed call from %@", [[result callResult] remoteUserId]]
                                    delegate:nil
                                    cancelButtonTitle:nil
                                    otherButtonTitles:@"OK", nil];
              [alert show];
          }
      }
  }
  
  -(void)voipRegistration
  {
      PKPushRegistry* voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
      voipRegistry.delegate = self;
      voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
  }
  
  -(void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type
  {
      [_sinchClient registerPushNotificationData:credentials.token];
  }
  -(void)pushRegistry:(PKPushRegistry *)registry   didInvalidatePushTokenForType:(PKPushType)type{
  
       NSLog(@"invalidated");
  }
  -(void)pushRegistry:(PKPushRegistry *)registry   didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:  (NSString *)type
  {
      //notify
      NSDictionary* dic = payload.dictionaryPayload;
      NSString* sinchinfo = [dic objectForKey:@"sin"];
      UILocalNotification* notif = [[UILocalNotification alloc] init];
      notif.alertBody = @"incoming call";
      [[UIApplication sharedApplication] presentLocalNotificationNow:notif];
      if (sinchinfo == nil)
          return;
  
      dispatch_async(dispatch_get_main_queue(), ^{
          [_sinchClient relayRemotePushNotificationPayload:sinchinfo];
      });
  }
  </code></pre>