code11遇到React Native启动报错的问题 getCurrentAppState:error 和 objectAtIndexedSubscript: 的解决方案

转载自:https://blog.csdn.net/lifeng__/article/details/101521095

我的xcode打包闪退,尝试启动项目,遇到React Native启动报错的问题,原本的项目的是Xcode10的,现在我更新了我Xcode版本到Xcode11.

报错为

Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]. Extend RCTConvert to support this type.

这个BUG是Xcode.11引起的, 可以查看这个问题的提交记录,链接为:https://github.com/facebook/react-native/issues/25138

我们只需要找到 RCTModuleMethod.mm 这个文件

修改

static BOOL RCTParseUnused(const char **input)

{

  return RCTReadString(input, "__unused") ||

         RCTReadString(input, "__attribute__((__unused__))") ||

         RCTReadString(input, "__attribute__((unused))");

}

 

 

 

这个函数插入    RCTReadString(input, "__attribute__((__unused__))") ||   这行代码重新运行就行了。

这样项目就能启动了,而且打包的app也不会闪退了。

posted @ 2020-07-30 13:02  野生野鸡码农  阅读(178)  评论(0编辑  收藏  举报