1
我不能讓Apple推送通知在開發模式下工作。當目標設備處於後臺模式時,永不會在源設備上調用shouldSendPushNotifications方法。如果兩個設備都處於前景模式,我已將我的APN開發證書上載到Sinch儀表板,並且即時消息傳遞工作正常。我有一個有效的設備令牌,我正在使用自己的推送消息。這裏是我的代碼:Sinch APN shouldSendPush Notifications never called
sinCli = Sinch.clientWithApplicationKey("XXXX", applicationSecret: "XXXX", environmentHost: "sandbox.sinch.com", userId: sinchUserId)
sinCli.delegate = self
sinCli.setSupportMessaging(true)
if let deviceToken = defaults.dataForKey(Globals.KEY_APN_DEVICE_TOKEN)
{
sinCli.setSupportPushNotifications(true)
sinCli.registerPushNotificationDeviceToken(deviceToken, type: SINPushTypeRemote, apsEnvironment: SINAPSEnvironment.Development)
sinCli.setPushNotificationDisplayName("MyApp")
}
sinCli.start()
sinCli.startListeningOnActiveConnection()
sinCli.messageClient().delegate = self
我忘記了什麼嗎?
我現在使用SinchService框架,而不是SINClient,它工作正常 – Tamas
酷,可以標記爲答案請? – cjensen
是的,但我仍想解決一個問題:在我的設置中,我可以關閉推送通知,但由於SinchService僅適用於啓用推送通知,所以如果用戶在設置中禁用推送通知,則必須使用SINClient。這有點麻煩,如果我可以在兩種情況下使用SinchService,會更好。 – Tamas