ios - Quickblox iOS 推送通知不起作用

标签 ios objective-c push-notification quickblox

在 Quickblox iOS 中,当我收到聊天消息或通过代码发送推送通知时,通知不起作用(尽管它适用于 Parse)。它工作的唯一方法是当我在管理面板上发送推送通知时选择“测试”-应用程序打开或处于后台模式时的环境(完全关闭时不工作)。

这是我用于通过 quickblox 发送聊天消息的代码:

-(IBAction)sendMessage:(id)sender{
    NSString *messageText = self.messageTextField.text;
    if(messageText.length == 0){
        return;
    }

    QBChatMessage *message = [QBChatMessage message];
    message.text = messageText;
    message.markable = YES;
    message.dialogID = self.dialog.ID;
    NSString *senderLogin = [LocalStorageController shared].qbUser.login;
    NSMutableDictionary *senderLoginDictionary = [[NSMutableDictionary alloc]init];
    [senderLoginDictionary setObject:senderLogin forKey:@"senderName"];
    [message setCustomParameters:senderLoginDictionary];

    [[QMServicesManager instance].chatService sendMessage:message toDialog:self.dialog save:YES completion:nil];

    // clean text field
    [self.messageTextField setText:nil];
}

我已经向 quickblox 提交了工单,但没有收到任何答复。

最佳答案

在 Quickblox 中有两种管理推送通知的方法:

  1. 自动聊天提醒(推送通知)。服务器将向与特定聊天对话相对应的所有离线用户发送推送通知。这是有关如何设置它的文档:http://quickblox.com/developers/Chat#Alerts

  2. 手动推送通知:您可以在每次向特定用户发送消息时发送推送通知。但请记住,所有推送通知都是基于平台的,您需要发送通用推送。有攻略:http://quickblox.com/developers/SimpleSample-messages_users-ios#Send_Push_Notifications_from_application_.28via_API.29

要设置 APNS 证书,请遵循本指南:http://quickblox.com/developers/SimpleSample-messages_users-ios

关于ios - Quickblox iOS 推送通知不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35894915/

相关文章:

push-notification - 无法在 Android 上获取 expo push token

iphone - 停止在 UIWebView 中播放视频

ios - 将两个标签连接到一个 socket

iOS 10/9 推送通知

ios - 自定义渲染器在 iOS + 库中不起作用

ios - UIView 中的损失质量图像

php - 规范注册 ID gcm

ios - 自定义单元永远不会为零(不要使用 Storyboard )

ios - 如何在 iOS 的 UIWebview 中删除特定的 cookie

iphone - 在 iOS 中播放嵌入的 youtube 视频后返回特定 View