Objective-C ARC was included in the PCH file but is currently disabled - Error

I am trying to convert an Objective-C project to ARC. When I add the -fno-objc-arc compiler flag to one or more individual files in the build phases, the following error appears in my MyProject-Prefix.pch file:

Objective-C automatic reference counting has been enabled in the PCH file, but is currently disabled.

+4
source share
1 answer

You must ensure that:

  • The compiler is configured for the Apple LLVM 4.x compiler
  • Project property: CLANG_ENABLE_OBJC_ARC enabled (change it to YES)
  • You have cleaned your project ( Product -> clean )

Following the steps above, you will make sure that you switched to ARC using the LLVM / clang compiler, if none of the above issues solve the problem, you can try to disable the precompiled prefix by unchecking the Precompile Prefix Header ( GCC_PRECOMPILE_PREFIX_HEADER ) in the XCode Build phase. Using PCH is optional because it is used to increase compilation time.

+2
source

Source: https://habr.com/ru/post/1439307/


All Articles