react-native-speech-iflytek
react-native-speech-iflytek copied to clipboard
[IFlySpeechUtility createUtility:initString]; 时报错,大神帮忙呀。
Assertion failed: (severity >= 0 && severity < NUM_SEVERITIES), function SetLogDestination, file /Users/samyao/Git/trace/node_modules/react-native/third-party/glog-0.3.4/src/logging.cc, line 595.
各种方法都试过,bitcode也关闭了,就是初始化时报错,无法继续,很急,很关键。
if (Platform.OS === 'ios') { Synthesizer.init("xxxxx");//也会报错 Recognizer.init("xxxxx"); } 2018年9月15号下载的最新sdk包:iOS_iat1174_tts_online1174_5b8e2af1.zip PS F:\Gitee\trace\trace> react-native -version react-native-cli: 2.0.1 react-native: 0.53.0
注释了这个方法的所有语句就好了: /* 通过注释掉loging文件解决了异常问题,目前不知道原理,实在是无奈: inline void LogDestination::SetLogDestination(LogSeverity severity, const char* base_filename) { //assert(severity >= 0 && severity < NUM_SEVERITIES); // Prevent any subtle race conditions by wrapping a mutex lock around // all this stuff. //MutexLock l(&log_mutex); //log_destination(severity)->fileobject_.SetBasename(base_filename); } */
我也遇到了
@zphhhhh 求解~~
注释了这个方法的所有语句就好了: /* 通过注释掉loging文件解决了异常问题,目前不知道原理,实在是无奈: inline void LogDestination::SetLogDestination(LogSeverity severity, const char* base_filename) { //assert(severity >= 0 && severity < NUM_SEVERITIES); // Prevent any subtle race conditions by wrapping a mutex lock around // all this stuff. //MutexLock l(&log_mutex); //log_destination(severity)->fileobject_.SetBasename(base_filename); } */
注释了这段也不行,但之前有时候就可以的,不知道怎么彻底解决,迷惑中,知道解决办法吗??
如果再次遇到,ios版本需要清理xcode编译环境缓存后,重新编译就好了。
@leeeGreat @Buddha 我的问题是: 1、比如项目的部署版本是ios8,则组件react-native-speech-iflytek的项目部署版本不能高于ios8 2、2019-2-24 下载的SDK还没这问题,这个似乎是新版本的问题 3、既然改不了讯飞的源码(猜测哪块调用glog时产生了野指针),还好能改 glog 的源码:
inline void LogDestination::SetLogDestination(LogSeverity severity,
const char* base_filename) {
//=============修改前的代码
//assert(severity >= 0 && severity < NUM_SEVERITIES);
//=============修改后的代码↓↓↓↓↓↓↓↓↓↓↓↓
char* base_filename_copy = nullptr; //初始化char*类型
base_filename_copy = const_cast<char*>(base_filename); //const char*类型转char*类型
if (severity >= 0 && severity < NUM_SEVERITIES) {
//
} else {
severity = 0;
base_filename_copy = const_cast<char*>("glogTest");
}
//============修改后的代码↑↑↑↑↑↑↑↑↑↑↑↑
// Prevent any subtle race conditions by wrapping a mutex lock around
// all this stuff.
MutexLock l(&log_mutex);
//=============修改前的代码
//log_destination(severity)->fileobject_.SetBasename(base_filename);
//=============修改后的代码↓↓↓↓↓↓↓↓↓↓↓↓
log_destination(severity)->fileobject_.SetBasename(base_filename_copy);
//============修改后的代码↑↑↑↑↑↑↑↑↑↑↑↑
}
注释代码可行,但是每次npm install之后,就会被重新覆盖,会产生另一个问题,很好奇你们是如何避免的 说一下我的解决方案: 在科大讯飞控制中心中提交工单,描述你是在RN环境产生的情况,技术人员会给你一个新的SDK包,然后问题解决