【声网SDK】集成声网RTC和RTM的SDK编译时报错Redefinition of enumerator

错误描述

在同时集成RTC和RTM的时候,编译的时候会报错,报错的原因是”Redefinition of enumerator“,应该是枚举类型的重复,截图如下:

相关搜索的关键词如下:
Redefinition of enumerator ‘AgoraAreaCodeCN’
Redefinition of enumerator ‘AgoraAreaCodeNA’
Redefinition of enumerator ‘AgoraAreaCodeEU’

解决方案

在官网已经有这个问题的解决方案了,但是文档并不是很详细,让开发者也会一头雾水;
https://docs.agora.io/cn/Real-time-Messaging/rtm_integration_bp?platform=iOS#agorartmareacode-枚举产生的命名冲突

详细补充方案如下:
1、注释掉AgoraRtmKit.h头文件,改引用AgoraRtmKit_swift.h头文件

//#import <AgoraRtmKit/AgoraRtmKit.h>
#import <AgoraRtmKit/AgoraRtmKit_swift.h>

2、无论你是pod集成的还是手动集成的,鼠标右键AgoraRtmKit.framework Show in Finder,然后删除AgoraRtmKit.h头文件,重新clean build就可以了

猜你喜欢

转载自blog.csdn.net/u014220518/article/details/124946675