Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
duheng opened this issue May 10, 2020 · 0 comments

Comments

@duheng
Copy link
Owner

duheng commented May 10, 2020

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

报错为

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

这个BUG是Xcode.11引起的, 可以查看这个问题的提交记录,链接为:facebook/react-native#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也不会闪退了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant