Error reading ‘pic’: Xcode6/cocoapods analyzer error

error reading 'pic'I started receiving this error today when building with Xcode 6: error reading ‘pic’…

I googled a lot and found helpful posts on how to fix it, but no single one of them did the trick. It seemed like I had to do several of them in combination and in the right order. I believe this was the ultimate fix…

Error Reading Pic Fix

1. From this post, add this to your Podfile

The ‘inhibit_all_warnings!’ will add the compile flag to your pods’ files and the code after it will add the ‘deadcode’ flag to the project file. I’m confident there’s a better/faster/easier way to do this, but this is the steps I took so that’s what I want to post.

2. Run pod install

Run ‘pod install’ on your project to update the compile flags and such from above.

3. Delete Derived Data

Go to Xcode>Preferences>Locations and look for the location of your derived data. Click the arrow and it will open that folder error reading 'pic' Xcode 6 cocoa pods errorin Finder.

Close Xcode!

Delete whatever folders that start w/ your project name (actually, I deleted them all and cleared up 35 GB!!!).


4. Build and Hope

Build your project. If you’re project is like mine, it will complain about specific files getting the “error reading ‘pic'”. For those specific files, remove the reference from your project and re-add the file. WARNING: Note where the file is in the project, your file structure and what compile flags are in the Build Phases.

Do a clean on your project, close Xcode, delete the Derived Data again (see step 3 above), open your workspace and build again. Repeat

NOTE: I also had a couple files in my project (not pods) that had similar compile flags like -w -Xanalyzer -analyzer-disable-checker. I had to go in and manually add ‘ -Xanalyzer deadcode’ for those files.