2016-04-25 74 views
1

我已經使用QuickBlox實現了一個聊天示例應用程序,並且我遵循了Quckblox提供的SampleChat應用程序(以下提供的Url)。但我想更新每封郵件的閱讀和遞送狀態。如何實現這一目標?如何使用Quickblox IOS更新已發送和已接收郵件的讀取和發送狀態?

  1. http://quickblox.com/developers/SimpleSample-chat_users-ios
  2. https://github.com/QuickBlox/quickblox-ios-sdk/tree/master/sample-chat

在鏈接1,他們解釋了一些代碼,但我無法實施。

+0

Quickblox已經提供狀態讀取和未讀狀態 –

+0

沒有這樣的代碼實現,我試圖實現,但它不工作 –

回答

3

在您提供的鏈接中有readdelivered狀態的文檔。

爲了使這個答案更加明確,有幾種方法可以將消息標記爲已讀和已發送。已交付標誌着只有XMPP的方式提供,使用這種方法從QBChat做到這一點:

/** 
Mark messages as read. 

@note Updates message "read" status only on server. 

@param dialogID dialog ID. 
@param messagesIDs Set of chat message IDs to mark as read. If messageIDs is nil then all messages in dialog will be marked as read. 
@param successBlock Block with response instance if request succeded. 
@param errorBlock Block with response instance if request failed. 
@return An instance, which conforms Cancelable protocol. Use this instance to cancel the operation. 
*/ 
+ (QB_NONNULL QBRequest *)markMessagesAsRead:(QB_NONNULL NSSet QB_GENERIC(NSString *) *)messagesIDs 
            dialogID:(QB_NONNULL NSString *)dialogID 
           successBlock:(QB_NULLABLE void(^)(QBResponse * QB_NONNULL_S response))successBlock 
            errorBlock:(QB_NULLABLE QBRequestErrorBlock)errorBlock; 

或XMPP的方法:

/** 
* Send "delivered" status for message. 
* 
* @param message  QBChatMessage message to mark as delivered. 
* @param completion Completion block with failure error. 
*/ 
- (void)markAsDelivered:(QB_NONNULL QBChatMessage *)message completion:(QB_NULLABLE QBChatCompletionBlock)completion; 

對於讀取標記,你可以使用QBRequest方法請使用REST請求QBChat:

/** 
* Send "read" status for message and update "read" status on a server 
* 
* @param message  QBChatMessage message to mark as read. 
* @param completion Completion block with failure error. 
*/ 
- (void)readMessage:(QB_NONNULL QBChatMessage *)message completion:(QB_NULLABLE QBChatCompletionBlock)completion; 

無論如何,如果您需要一個「實時」示例,請仔細閱讀樣本和文檔。

+0

其實我使用QMChat視圖控制器,QMServices所以這些回調是由處理他們。而我的疑問是如何知道天氣這個perticuler消息是否被刪除或閱讀或不。我想知道在我的模型(QMChatSectionManager * chatSectionManager)或(QBChatMessage *消息)中的這種狀態如何知道這一點? –

+0

查看QBChat代表。您可以隨時訂閱他們。 –

+0

您好,先生,我有一個要求,我想要爲每個快速blox用戶上傳配置文件圖像,並從那裏它應該顯示給其他用戶誰想要創建一個聊天對話框,我看到了示例內容示例提供的第一個用戶。但在這裏,我的情況是不同的所以,你可以幫我 –

相關問題