Search code examples
iosxcode6.3pch

Cant find LLVM6.0 in build settings to add .pch prefix header


I created a new project using Xcode 6.3.1 and I want to manual add a 'pch' file to my project. I was looking at questions online PCH File in Xcode 6 but the selected answer says to go to LLVM6.0 but that does not exist in build settings anymore. Where can i find it to add the .pch?


Solution

  • To create a prefix header (pch) file you'll have to do the following:

    1. Go to (or use ⌘cmd+N) File > New > File > Other (in iOS or OSX).
    2. Select PCH File.
    3. Give it a name and store it somewhere in your project.
    4. Go to your project's target > Build Settings.
    5. Search for prefix header.
    6. Under Apple LLVM 6.1 - Language you will find the Prefix Header key.
    7. Add the path to your pch file like so: $(PROJECT_NAME)/myPrefixHeaderFile.pch.
    8. Clean your project (⌘cmd+⇧shift+K) and build (⌘cmd+B).

    Below is a screenshot showing where to find it in Build Settings: Prefix Header (PCH) File