//通过透传发送当前位置信息给领导
EMChatCommand *shareCommand =
[[EMChatCommand alloc] init];
shareCommand.cmd = @"ResponseLocation"; // 当前cmd消息的关键字
EMCommandMessageBody *shareMsgBody =
[[EMCommandMessageBody alloc] initWithChatObject:shareCommand];
//设置要发给谁, fromToken是环信用户username或者群聊groupid
EMMessage *shareMsg = [[EMMessage alloc] initWithReceiver:_fromToken bodies:@[shareMsgBody]];
shareMsg.messageType = eMessageTypeChat; // 单聊或者群聊
//latitude,longitude:获取到的经纬度
shareMsg.ext = @{
@"latitude":[NSString stringWithFormat:@"%f",lat],
@"longitude":[NSString stringWithFormat:@"%f",lng],
@"reporttime":_reporttime,
@"track":@""
};
[[EaseMob sharedInstance].chatManager asyncSendMessage:shareMsg progress:nil];
|