简体   繁体   English

使用Quickblox进行Quickblox聊天

[英]Quickblox chat using quickblox

I am working on chat module of application using quickblox. 我正在使用quickblox开发应用程序的聊天模块。 It is working properly. 它工作正常。 But i am not receiving any push notification for chat message while the application is terminated.Can any one help me in this? 但是在应用程序终止时,我没有收到任何关于聊天消息的推送通知。有人可以帮我吗?

As you want to received Push Notification, for that you need to verify the below steps. 当您想要接收推送通知时,为此,您需要验证以下步骤。

Step 1: Setup all certificates and passphrase to send notification in quickblox Portal. 步骤1:设置所有证书和密码以在quickblox Portal中发送通知。

  • Login to quickblox portal. 登录到quickblox门户。
  • Select you created application. 选择您创建的应用程序。
  • Click on "Push notification" menu from left menu list. 从左侧菜单列表中单击“推送通知”菜单。
  • Click on "Settings" menu from top right tabs. 单击右上角选项卡上的“设置”菜单。
  • In settings section you need to set all relative certificates and keys. 在设置部分,您需要设置所有相关的证书和密钥。

Step 2: After setting up all the information need by quickblox portal. 步骤2:在设置quickblox门户所需的所有信息之后。 You need to add code in you application for subscribe to get notification for login user's device. 您需要在应用程序中添加代码以订阅以获取登录用户设备的通知。

NSString *deviceIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
QBMSubscription *subscription = [QBMSubscription subscription];
subscription.notificationChannel = QBMNotificationChannelAPNS;
subscription.deviceUDID = deviceIdentifier;
subscription.deviceToken = <Replace-Device-Token-Here>;
[QBRequest createSubscription:subscription successBlock:^(QBResponse *response, NSArray *objects) {
    // Success.
} errorBlock:^(QBResponse *response) {
    // Error.
}];

Step 3: Once user perform logout action then you need to unsubscribe the push notification from quickblox server to stop receiving notification to registered device. 步骤3:用户执行注销操作后,您需要取消订阅quickblox服务器的推送通知,以停止接收已注册设备的通知。

NSString *deviceUdid = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
[QBRequest unregisterSubscriptionForUniqueDeviceIdentifier:deviceUdid successBlock:^(QBResponse *response) {
    // Success.
} errorBlock:^(QBError *error) {
    // Error.
}];

Let me know if you have any comment on the same. 让我知道您是否对此有任何评论。

Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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