即时消息推送通知使用Sinch不在iOS上 [英] Instant Message Push Notification Using Sinch not coming on iOS

查看:124
本文介绍了即时消息推送通知使用Sinch不在iOS上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[![在此处输入图片说明] [1]] [1]我已经提到了所有字段,但我仍然没有收到推送通知。
这是我的代码:

[![enter image description here][1]][1]I've mentioned all the fields but still I'm not getting the push notification. This is my code:

首先在didFinishLaunchingWithOptions中我称之为:

Firstly in didFinishLaunchingWithOptions I call this:

        self.push = Sinch.managedPushWithAPSEnvironment(.Production)
        self.push?.delegate = self
        self.push?.setDesiredPushTypeAutomatically()

        client = Sinch.clientWithApplicationKey("xxxxxx", applicationSecret: "xxxxxxx", environmentHost: "sandbox.sinch.com", userId: userID)
        client?.delegate = self
        client?.setSupportMessaging(true)
        client?.setSupportPushNotifications(true)
        client?.enableManagedPushNotifications()
        client?.start()
        client?.startListeningOnActiveConnection()

        self.push?.registerUserNotificationSettings()

func managedPush(managedPush: SINManagedPush!, didReceiveIncomingPushWithPayload payload: [NSObject : AnyObject]!, forType pushType: String!) {

        self.client?.relayRemotePushNotification(payload)
    }


func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {

        let tokenChars = UnsafePointer<CChar>(deviceToken.bytes)
        var tokenString = ""

        for i in 0..<deviceToken.length {
            tokenString += String(format: "%02.2hhx", arguments: [tokenChars[i]])
        }

        self.push?.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
    }


func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
        self.push?.application(application, didReceiveRemoteNotification: userInfo)
    }

我还在我的sinch仪表板中上传了推送证书。

I've also uploaded the push certificate in my sinch dashboard.

我可能知道我在这段代码中遗漏了什么,这可能是我没有得到推动的原因。

May I know what am I missing in this code that might be the reason I'm not getting push.

已编辑:

以下是Sinch Dashboard上传的推送分发证书的图片。

Here is the image of the uploaded push distribution certificate on Sinch Dashboard.

http://i.stack.imgur.com/d6PVb.png

推荐答案

您不应该拥有客户端?.setSupportPushNotifications(true)那就是您想要处理推动自己的时间

You should not have client?.setSupportPushNotifications(true) thats for when you want to handle the push your self

这篇关于即时消息推送通知使用Sinch不在iOS上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆