Mozi icon indicating copy to clipboard operation
Mozi copied to clipboard

xcode11启动报错 Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]

Open duheng opened this issue 4 years ago • 0 comments

xcode11打包后闪退,启动报错;xcode每次升级都会出幺蛾子,习惯就好 image

报错为

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 这个文件,大约在93行左右

文件是在node_modules/react-native/React/base/RCTModuleMethod.mm 这个位置,

在Xcode可以直接搜索 RCTModuleMethod. 这个文件,

修改

static BOOL RCTParseUnused(const char **input)

{

  return RCTReadString(input, "__unused") ||

         RCTReadString(input, "attribute((unused))") ||

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

}

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

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

duheng avatar May 10 '20 04:05 duheng