In my experience, it is far more likely to be caused by a bug (or undocumented behaviour) in Xcode, than it is by you having an error in your configuration.
I wrote a somewhat detailed post about my experiences here:
Following those steps (any knowing about the pit falls now) always fixed it for me.