[iOS] When scheme is Release, Undefined symbol: _RCTSetLogFunction
Question
Upgrade React Native 0.60 to 0.61. When Scheme is set to Debug, it runs without problems. An error is reported when set to Release.
Undefined symbols for architecture i386:
"_RCTSetLogFunction", referenced from:
-[O2OTests testRendersWelcomeScreen] in O2OTests.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbol: _RCTSetLogFunction
Solution
I found 2 ways to solve it.
1. Set Dead Code Stripping to NO
In Xcode, select PROJECT-> Build Settings-> LInking-> Dead Code Stringpping, set it to NO, and recompile.
2. Modify Tests.m code
Refer to https://github.com/facebook/react-native/pull/25751/files. Change the Tests.m file code of the Tests project