2017-01-05 11 views
1

iPhone(iOS 10)でアプリが閉じられている場合は、通話を開始できません。Sinch - 閉じた状態で通話が開始されない

私はコールのためのプッシュキットサービスを使用しています。 アプリがバックグラウンドの場合は電話を受けていますが、アプリが閉じた状態であればサーバーから通知を受信して​​も通話は開始されません。

_clientオブジェクトはゼロではありません。

私はコードの下でSINCHクライアントを初期化しています::

以下
- (void)initSinchClientWithUserId:(NSString *)userId 
{  
    if (!_client) { 

     if(userId.length <= 0) 
      return; 


     _client = [Sinch clientWithApplicationKey:SINCH_APP_KEY 
             environmentHost:SINCH_ENVIRONMENT_HOST 
               userId:userId]; 

     _client.delegate = self; 
     _client.callClient.delegate = self; 
     [_client setSupportCalling:YES]; 

     [_client setSupportActiveConnectionInBackground:YES]; 

     [_client setSupportPushNotifications:YES]; 
     [_client start]; 

     [_client startListeningOnActiveConnection]; 

    } 

} 

didReceiveIncomingPushWithPayload方法

-(void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type 
{ 

    NSDictionary* dic = payload.dictionaryPayload 

    if([dic.allKeys containsObject:@"sin"]) 
    { 
     NSString* sinchinfo = [dic objectForKey:@"sin"]; 

     if (sinchinfo == nil) 
      return; 

     dispatch_async(dispatch_get_main_queue(), ^{ 
      [_client relayRemotePushNotificationPayload:sinchinfo]; 
     }); 
    } 
} 

ノートのコードです::私はそれが働いている、iOSの9のチェックを持っています以下のように正しく呼び出されます。

- (SINLocalNotification *)client:(id<SINClient>)client localNotificationForIncomingCall:(id<SINCall>)call 
{ 

} 
+0

同じ問題に直面して、アプリが完全に閉じている間に電話を受けることができません。ローカル通知はありません。生成されたコールのリモート通知はありません。また、クライアントが正しく起動されていることを確認してください。 –

+0

iOS 10用にNSUserNotificationを使用しましたか? –

+0

@VishalSonawaneローカル通知に問題はありません。** SINCH SDKの** delegateメソッド**に問題があります。 iOS10では呼び出されません。 –

答えて

1

Sinch初期化のために、このコードを使用してみてください:

1.はあなたviewController

@property (nonatomic, readwrite, strong) id<SINManagedPush> push; 

でプロパティを宣言しAppDelegatedidFinishLaunchingWithOptions

//Sinch managed Push Notifications 
    self.push = [Sinch managedPushWithAPSEnvironment:SINAPSEnvironmentAutomatic]; 
    self.push.delegate = self; 
    [self.push setDesiredPushTypeAutomatically]; 
    //Sinch Remote notifications 
    id config = [[SinchService configWithApplicationKey:SINCH_KEY 
             applicationSecret:SINCH_SECRET 
             environmentHost:SINCH_HOST] 
       pushNotificationsWithEnvironment:SINAPSEnvironmentProduction]; 

    id<SINService> sinch = [SinchService serviceWithConfig:config]; 
    sinch.delegate = self; 
    sinch.callClient.delegate = self; 
にコードの下に追加します。

最後に

- (void)initSinchClientWithUserId:(NSString *)userId { 
    if (!_client) { 
     _client = [Sinch clientWithApplicationKey:SINCH_KEY 
           applicationSecret:SINCH_SECRET 
            environmentHost:SINCH_HOST 
              userId:userId]; 

     _client.delegate = self; 
     _client.callClient.delegate = self; 
     [_client setSupportCalling:YES]; 
     [_client enableManagedPushNotifications]; 
     [_client start]; 
    } 
} 
関連する問題