Xcode 11.0 构建获取错误 - 方法中的未知参数类型“__attribute__” -[RCTAppState getCurrentAppState:error:]

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/58051510/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:01:26  来源:igfitidea点击:

Xcode 11.0 build get error - Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]

iosreactjsxcodereact-native

提问by d3tr1tus

On every build in Xcode i get this error. How can i fix it?

在 Xcode 中的每个构建中,我都会收到此错误。我该如何解决?

I found this commit https://github.com/facebook/react-native/pull/25146/commits/61b8b9e69d8609fecaaaa7d2c9e32808bc5e98cbwhich should fix it but nothing happened.

我发现这个提交https://github.com/facebook/react-native/pull/25146/commits/61b8b9e69d8609fecaaaa7d2c9e32808bc5e98cb应该修复它但什么也没发生。

static BOOL RCTParseUnused(const char **input)
{
 return RCTReadString(input, "__unused") ||
     RCTReadString(input, "__attribute__((__unused__))") ||
     RCTReadString(input, "__attribute__((unused))");
}

I have still this error

我仍然有这个错误

enter image description here

在此处输入图片说明

Can you help me fix it please?

你能帮我修一下吗?



I looked in node_modules and i already have this line

我查看了 node_modules,我已经有了这条线

static BOOL RCTParseUnused(const char **input)
{
  return RCTReadString(input, "__unused") ||
         RCTReadString(input, "__attribute__((__unused__))") ||
         RCTReadString(input, "__attribute__((unused))");
}

Do you have another advice please?

请问您还有什么建议吗?

回答by David Schumann

The solution is to either Upgrade to RN 59.9 or higher OR to apply this patchmanually:

解决方案是升级到 RN 59.9 或更高版本或手动应用此补丁

  1. go to node_modules/react-native/React/Base/RCTModuleMethod.mm
  2. Add the line from the patch.
  1. node_modules/react-native/React/Base/RCTModuleMethod.mm
  2. 添加补丁中的行。

回答by Manoj Alwis

Solution for this issue: go to node_modules/react-native/React/Base/RCTModuleMethod.mm and update below code

此问题的解决方案:转到 node_modules/react-native/React/Base/RCTModuleMethod.mm 并更新以下代码

static BOOL RCTParseUnused(const char **input)
{
  return RCTReadString(input, "__attribute__((unused))") ||
           RCTReadString(input, "__attribute__((__unused__))") ||
           RCTReadString(input, "__unused");
}