Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

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

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

Do you have another advice please?

like image 288
d3tr1tus Avatar asked Sep 22 '19 17:09

d3tr1tus


2 Answers

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

  1. go to node_modules/react-native/React/Base/RCTModuleMethod.mm
  2. Add the line from the patch.
like image 159
David Schumann Avatar answered Nov 10 '22 01:11

David Schumann


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

static BOOL RCTParseUnused(const char **input)
{
  return RCTReadString(input, "__attribute__((unused))") ||
           RCTReadString(input, "__attribute__((__unused__))") ||
           RCTReadString(input, "__unused");
}
like image 38
Manoj Alwis Avatar answered Nov 10 '22 03:11

Manoj Alwis