简体   繁体   中英

Sinch: user does not receive the call for the first time

I implemented Sinch + PushKit + CallKit , everything works fine, but there is one script that does not work correctly. The first user uses the application and removes it from the device's memory, the second user calls for the first time, the first user does not receive the call, if the second user immediately calls the second time, the first user receives a call (later the first user also receives a call). If the first user opens the application (that is, becomes online for the system), the first user will not receive the call again. How can I fix it?

initialization of the sinch client

open func setup() {
        guard sinch == nil else { return }
        guard let userID = UserRealmManager().getUser()?.id else { return }
        sinch = Sinch.client(withApplicationKey: key, applicationSecret: secret, environmentHost: host, userId: userID)
        sinch?.delegate = self
        sinch?.call().delegate = self

        sinch?.setSupportCalling(true)
        sinch?.enableManagedPushNotifications()
        sinch?.setSupportPushNotifications(true)

        sinch?.start()
        sinch?.startListeningOnActiveConnection()
    }

Update: I also found that if I restart the iPhone then calls through CallKit start to show up in 2-4 minutes, I decided to test it on the famous messangers such as What's app and Telegram and they have exactly the same behavior. Of course, I think it needs to be asked as an additional question.

My devices are iPhone 6 and 7.

这是我的错误,因为我仅在MainTabBarController viewDidLoad()初始化了SinchManager (这是管理SINClient的管理器viewDidLoad() ,在我开始在AppDelegate didFinishLaunchingWithOptions初始化它之后,一切正常。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM