AgoraIO-Community / Agora-Unity-RTM-SDK

A Unity3D sample app to show Login /Logout, Log in to/out of channel, Get Channel Member Count, Send/Receive Channel Message, Send Peer Message, Query Member, and token Authentication
24 stars 15 forks source link

设置频道属性发生异常 #15

Closed ahjszll closed 3 years ago

ahjszll commented 3 years ago

`AGORA_API int setChannelAttributes(void rtmInstance, const char channelId, long long attributes[], const int numberOfAttributes, bool enableNotificationToChannelMembers, long long requestId) { if (numberOfAttributes <= 0) return -1;

agora::rtm::ChannelAttributeOptions channelAttributeOptions;
channelAttributeOptions.enableNotificationToChannelMembers = enableNotificationToChannelMembers;

std::vector<const agora::rtm::IRtmChannelAttribute *> test;
test.resize(numberOfAttributes);

for(int i = 0; i < numberOfAttributes; i++) {
    test.push_back(reinterpret_cast<agora::rtm::IRtmChannelAttribute *>(attributes[i]));
}

return RTM_SERVICE_INSTANCE->setChannelAttributes(channelId, &test[0], numberOfAttributes, channelAttributeOptions, requestId);

}` 这里设置频道属性,test.resize(numberOfAttributes) 会新增一个null对象,执行RTM_SERVICE_INSTANCE->setChannelAttributes,发生异常

QQ截图20210107154620

zhangtao1104 commented 3 years ago

已经修复,可以更新代码再试下。