当查看disconnect()方法及其描述时,它在文档中说以下内容



但是看一下shouldIncludeDirectChannel属性



看来他们做的事情并不完全相同,但我可能是错的。谁能为我澄清一下?

最佳答案

所以我发现的是这个。

不再需要connect()和connect()函数。您只需将bolean设置为true即可建立连接。

我把头撞在墙上,因为如果出现错误警告。

func applicationDidEnterBackground(_ application: UIApplication) {
        Messaging.messaging().disconnect()
        print("Disconnected from FCM.")
    }

到:
        func applicationDidEnterBackground(_ application: UIApplication) {
        Messaging.messaging().shouldEstablishDirectChannel = false
        print("Disconnected from FCM.")
    }

通过将bolean设置为true,连接也是如此。因为现在有地方可以解释这种变化,所以我应该加篷车。我也在设备上对此进行了测试,但仍在接收推送通知。

关于ios - connect()已弃用: Please use the shouldEstablishDirectChannel property instead,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44176168/

10-13 04:19