40

So I accidentally modified a header (CBCentralManager.h) and caused the above error to show when I build. I searched stack overflow for the solution, and found this. Even after deleting the derived data, I still get the same error. I've also tried to delete the ModuleCache/FUW5IOHP9BIS folder with no success.

Here is the specific error I'm seeing:

file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentralManager.h' has been modified since the precompiled header '/var/folders/pj/hslm53_51xxd_npfqym5r6z00000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/5.0-5A1412/Xcode/ModuleCache/FUW5IOHP9BIS/CoreBluetooth.pcm was built

Any help is greatly appreciated.

Community
  • 1
  • 1
Mark
  • 7,167
  • 4
  • 44
  • 68
  • have you tried clean and rebuild from xcode's menu? – Iłya Bursov Oct 15 '13 at 22:06
  • Yes, I've tried everything in the link in the question. It doesn't make sense that clearing the derived data does not fix this problem. – Mark Oct 16 '13 at 14:26
  • Possible duplicate of http://stackoverflow.com/questions/14793329/fixing-file-project-pch-has-been-modified-since-the-precompiled-header-was-bui – Brian Jan 23 '14 at 17:12
  • Try this... http://stackoverflow.com/a/25843228/2557910 Worked fine for me. – Jorge SV Sep 15 '14 at 08:05

13 Answers13

90

I faced this issue on OS10.10 with Xcode 6. I resolved issue by removing .pcm files.

To delete press 'shift+command+g' & delete all .pcm files or goto the folder ~/Library/Developer/Xcode/DerivedData/ModuleCache/ & delete all .pcm files.

Perform deep clean by pressing 'shift+alt+command+k.

Hope it will work for you.

Gagan_iOS
  • 3,638
  • 3
  • 32
  • 51
  • Thank you for explaining where they are and the environment you were in. – Morkrom Sep 18 '14 at 18:36
  • 11
    Deleting the whole ModuleCache folder worked for me with Xcode6 – Toydor Sep 18 '14 at 20:59
  • OSX 10.10.2/Xcode 6.2. 1) There are no .pcm files listed anywhere in my project. 2) Pressing shift+command+g in Xcode does nothing except make a bonk! sound. 3) There are no .pcm files in the directory ~/Library/Developer/Xcode/DerivedData/ModuleCache/ – 7stud Apr 17 '15 at 04:43
  • None of my old projects will build, and a new project won't build either. Wow, Xcode6 is a super IDE! – 7stud Apr 18 '15 at 17:06
  • @7stud I have not started using XCode6.2.x. Might be possible that Apple made some changes in Xcode IDE. – Gagan_iOS May 07 '15 at 12:13
  • What worked for me was doing what @Laith suggested: `~/Library/Developer/Xcode$ rm -rf DerivedData`. – 7stud May 07 '15 at 16:45
  • Cool,it is good way to clean pem files. Awesome. Thanks – knight2016 Dec 27 '21 at 10:59
  • Deleting ModuleCache also worked in 2023 with Xcode 14.3 – bkbeachlabs Apr 25 '23 at 01:30
49

Deleting ~/Library/Developer/Xcode and restarting Xcode fixed this for me (Xcode 6 B7). Suspect an aggressive caching bug. Warning! This deletes archives from all your projects.

No amount of cleaning / build folder cleaning / derived data deleting helped before that.

Jespertheend
  • 1,814
  • 19
  • 27
Philip McDermott
  • 1,068
  • 1
  • 10
  • 9
24

Remove the pcm file

rm "/var/folders/pj/hslm53_51xxd_npfqym5r6z00000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/5.0-5A1412/Xcode/ModuleCache/FUW5IOHP9BIS/CoreBluetooth.pcm"

then

Clean Project( Cmd+Shift+K)

Problem solved

khanghoang
  • 1,125
  • 12
  • 14
  • I've tried deleting the whole ModuleCache folder with no success (see question). Unless you're implying that deleting just the CoreBluetooth.pcm will fix the problem. – Mark Jan 14 '14 at 15:23
  • for my case, i just need to delete pcm file then clean and it worked :) – khanghoang Jan 15 '14 at 09:31
  • @Mark: ya, i meant so, because in the most of my cases i always try like this first. :D – khanghoang Feb 15 '14 at 08:04
  • 1
    the solution for me with my Jenkins build was to add rm -Rf $TMPDIR../C/com.apple.DeveloperTools/*/Xcode/*/Xcode/SharedPrecompileHeaders/ – phyzalis Oct 02 '14 at 06:21
5

Just select clean from the project menu. That should force a complete rebuild and solve the rproblem.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
  • 2
    This is the first thing I tried. Clean did not fix the issue, nor did build folder clean. Neither did deleting the derived data folder. – Mark Oct 21 '13 at 20:26
  • @Mark, sounds like an Xcode bug. I would suggest submitting an Apple Radar bug. – Duncan C Jan 09 '14 at 13:09
  • 1
    Will do. I'll link the radar bug in the original question once I've submitted it. – Mark Jan 09 '14 at 13:32
4

Try going to your Organizer -> Projects, and you'll see the path for where you're derived data is saved. Mine looks something like "~/Library/Developer/Xcode/DerivedData/[Project name]-[mumbo jump]"

Delete the "[Project name]-[mumbo jump]" folder, and you should be all good.

bunz4u
  • 49
  • 1
  • 1
  • This is what the link in my question suggested, and it is the first thing I tried. It does not fix my issue, as the error is thrown again. – Mark Oct 16 '13 at 18:21
  • The important part for me was to find where my derived data is and cleaning that, rather than assuming it's in ~/Library/. Mine is at ~/Developer/Xcode/DerivedData so I cleaned that and the ModuleCache and that fixed it – ghr Aug 13 '15 at 00:23
4

Deep clean (Cmd + Opt + Shft + K), clearing folder DerivedData, clearing simulator, restarting Xcode and mac doesn't work for me.

Problem was fixed only after changing pch-file (adding a whitespace or comment/uncomment some code). File was incorrectly cached on build phase by Xcode. Changing this file fixed problem.

KepPM
  • 1,129
  • 7
  • 17
3

Manually deleting the DerivedData folder fixed it for me.

Laith
  • 409
  • 6
  • 13
  • 1
    Yes, this worked for me too. Thanks! `$ cd ~/Library/Developer/Xcode/` then `~/Library/Developer/Xcode$ rm -rf DerivedData`. – 7stud Apr 17 '15 at 04:46
2

So it seems the only way to fix this issue is to uninstall Xcode and download it again. This fixed my problem.

Mark
  • 7,167
  • 4
  • 44
  • 68
2

quit xcode and reopen it .This fixed my problem.

satyso
  • 21
  • 1
1

I was facing this issue. Deleting moduleCache and restarting Xcode & Mac did not help me to resolve the issue.

Solution that worked for me: I copied the path "/private/var/folders/5s/1q3qz48j6zxc028txvdyqhwr000btt/C/org.llvm.clang/ModuleCache" in Finder->Go to folder, deleted all the folders from that ModuleCache.

Now I am able to build successfully.

Manisha
  • 55
  • 6
0

You can also try these, clean and then build again

find /var/folders 2>&1 | grep -v 'Permission denied' | grep '\.pcm' | xargs rm
find ~/Library/Developer/Xcode/DerivedData 2>&1 | grep -v 'Permission denied' | grep '\.pcm' | xargs rm
Maciej Swic
  • 11,139
  • 8
  • 52
  • 68
0

Nothing above works for me, even uninstalling Xcode. Finally, I tried copying the modified file from other project to my current project, this worked.

0

I tried deleting the precompiled ~/Library/Developer/Xcode and restarting Xcode, plus a few of the other ideas presented here, nothing was working. As it seems to be a multiple-target kind of issue, I found after changing the target to another target, building/uploading the other target successfully, then changing back (after doing the other things) to the target I was looking to build / upload originally, I was finally successful.