title: AST Deserialization issue and build module error
body: <p>So, I don't know how but one day I've start getting this type or errors:
  (sometimes two errors)</p>
  <blockquote>
  <p>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVMetalTextureCache.h:30:2: Malformed or corrupted AST file: 'Unable to load module &quot;/Users/WildMassacre/Library/Developer/Xcode/DerivedData/ModuleCache/1CGHHHX14XIR3/Foundation-1LVW63VL3OCXN.pcm&quot;: signature mismatch'</p>
  </blockquote>
  <p>(By the way what is &quot;signature mismatch?&quot;. Sometimes it's &quot;file out of date&quot; and another type of error which I can't remember at this moment).</p>
  <p>And a lot of (sometimes only one or two errors. different modules. sometimes it is Foundation / UIKit / Metal / CoreVideo / etc):</p>
  <blockquote>
  <p>/Users/WildMassacre/Documents/Developing/iOS/Provocante/Store/SizeCell.h:9:9: Could not build module 'UIKit'</p>
  <p>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIColor.h:10:9: Could not build module 'CoreImage'</p>
  </blockquote>
  <p>and etc.</p>
  <p><strong>First of all, yes, I've tried to delete derived data and clean (or deep clean) project – nothing works.</strong>
  And as someone told me I've tried to change DerivedData folder to relative instead of default — same errors.</p>
  <p>I'm so confused because I submitted my app to the AppStore before (for TestFlight actually), but now — I got this errors. (and i don't remember that i change something global)
  Sometimes (sic!) it can build successfully and then when I try to archive — error. And sometimes it can't build at all. Sometimes (just randomly as i can see) it can build and run on simulator/real device. And again there was no time I can archive this (i mean when I start getting this error, not when I upload my app to the AppStore).</p>
  <p>As you can notice I used a word &quot;sometimes&quot; a lot. Well, because I really don't know why I'm still getting this errors in a different forms(?) and different modules randomly. (for example, it worked twice at least: build (errors) -&gt; change in Build Settings use C and Objective-C modules to NO -&gt; build (errors) -&gt; change back to YES -&gt; build (no errors))
  Or it can build and run on simulator but can't on real device/&quot;ios device&quot;..</p>
  <p>My flags in Build Settings: (for MailCore 2.0 and some other libs)</p>
  <pre><code>-lctemplate-ios
  -lxml2
  -letpan-ios
  -lsasl2
  -liconv
  -ltidy
  -lz
  -lc++
  -lresolv
  -stdlib=libc++
  -ObjC
  </code></pre>
  <p>I really don't know what to do: I've searched a lot, saw a lot of questions here, on stackoverflow, but nothing works.</p>
  <p>By the way, I have changed my project name and then scheme and etc.. I thought that I can do something wrong while doing that.
  But when I open my reserve project with no project name changes – same errors.</p>
  <p>Maybe I should delete and clean project another way? Or change something in projects scheme (not only the name(&quot;old&quot;-&gt;&quot;new&quot;) as I did)?
  Reinstall Xcode?
  Or maybe you can tell me what can i changed in my project to start getting this error, because I don't remember that I change something (since project version that i uploaded to the app store) except ~200 code lines.</p>
  <p>Please tell me if I have to provide you more information about the project.</p>
  <p>I hope you can help me to solve this issue! Thanks!</p>
  <p><strong>______________________________________________________________</strong></p>
  <p>Added:</p>
  <p><strong>The problem is <em>Optimization</em>! (i think). When I tried to archive (change in scheme) as debug (not release) — its ok and I can archive it without optimization.</strong></p>
  <p><strong>Then I tried to set any type of optimization (in Build Settings — Apple LLVM 6.1 Code-Generation — Optimization Level) for example: Fastest/Smallest or Fast. And any option except &quot;None&quot; (no optimization) will throw an error. But! When I set optimization level to None in release build and then try to archive as release — still error. Maybe optimization doesnt matter now? I'so confused! This is really magic happening to this project.</strong></p>
  <p><strong>Why?</strong></p>
  <p><strong>______________________________________________________________</strong></p>
  <p>Added:
  And know it can archive as debug but with -O3 optimization...
  So, maybe something wrong in my release settings? Can you give me a tips?</p>
  <p>Thanks for read all of this.</p>