0
所以創建了一個簡單的應用程序來測試sendbird服務,他們看起來最好,所以我已經閱讀他們的文檔,並在這一刻。我做了一件事......我在那裏遇到了問題,何時必須調用didReceiveMessage或爲什麼我的工作不正常?發送鳥didReceiveMessage不工作
mycode的
- (IBAction)connnect:(id)sender {
[SBDOpenChannel getChannelWithUrl:@"iDict" completionHandler:^(SBDOpenChannel * _Nullable channel, SBDError * _Nullable error) {
if (error != nil) {
NSLog(@"Error 1 : %@", error.localizedDescription);
return;
}
[channel enterChannelWithCompletionHandler:^(SBDError * _Nullable error) {
if (error != nil) {
NSLog(@"Error: %@", error);
return;
}
NSLog(@"Connected to Channel : %@",channel.channelUrl);
// ...
}];
}];
}
- (IBAction)sendMessage:(id)sender {
[self.channel sendUserMessage:@"pop" data:@"Hey" completionHandler:^(SBDUserMessage * _Nullable userMessage, SBDError * _Nullable error) {
if (error != nil) {
NSLog(@"Error: %@", error);
return;
}
}];
}
- (void)channel:(SBDBaseChannel * _Nonnull)sender didReceiveMessage:(SBDBaseMessage * _Nonnull)message {
if (sender == self.channel) {
NSLog(@"From Button.Message Received From %@ message is : %@ in channel :",sender.description,message.description);
} else {
NSLog(@"Failed");
}
}
@end
謝謝隊友。但是我這樣做了,做了很多,我的儲備是UNIQUE_HANDLER_ID,我不知道那是什麼。 –