2017-01-11 11 views
0

私はiOSバージョン9とswiftも使用しています。私はアプリがアクティブである間に電話を受けることができますが、アプリが閉鎖されていたり、バックグラウンドになっていたりすると、通知が届くだけで、着信音(SinchServiceを使用しています)ではなく、私は、VoIPの証明書を追加しましたし、それが有効だVoIP着信音が動作しない

コード

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { 
    sinch?.push().application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken) 
} 

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { 
    sinch?.push().application(application, didReceiveRemoteNotification: userInfo) 
} 


func startManager() { 
    let config = SinchService.config(withApplicationKey: VoiceManager.SinchKey, applicationSecret: VoiceManager.SinchSecret, environmentHost: VoiceManager.SinchHost).pushNotifications(with: SINAPSEnvironment.development) 
    let sinch = SinchService.service(with: config) 
    sinch?.delegate = self 
    sinch?.callClient().delegate = self 

    let push = Sinch.managedPush(with: SINAPSEnvironment.development) 
    push?.delegate = self 
    push?.setDesiredPushTypeAutomatically() 

    let appDelegate: AppDelegate = (UIApplication.shared.delegate as! AppDelegate) 
    appDelegate.sinch = sinch 
    appDelegate.push = push 
} 

// MARK: - SINCallClientDelegate

func client(_ client: SINCallClient!, didReceiveIncomingCall call: SINCall!) { 
    //show calling view 
    let controller = UIViewController.currentViewController() 
    VoiceCallingViewController.show(call: call, viewController: controller) 
} 


func client(_ client: SINCallClient!, localNotificationForIncomingCall call: SINCall!) -> SINLocalNotification! { 
    let notification = SINLocalNotification() 
    notification.alertAction! = LanguageManager.localizedString(key: "answer") 
    notification.alertBody = "\(LanguageManager.localizedString(key: "incomming-call")) \(call.remoteUserId)" 
    return notification 
} 

答えて

0

あなたが方法をlocalnotificationにあなたがどんな音を設定されていません。通知に音を追加する

関連する問題