Cocos2d-x project's 2nd rebuild onwards gives an error 'Xcode cannor run using selected device'

When I build fresh project using Xcode it works fine on device/simulator.
But if I make any changes to the cpp files, rebuilds it and try to run on device/simulator, Xcode throw’s an error-
>Xcode cannor run using selected device. Choose a destination with a supported architecture in order to run on this device.

To make it work, every time I have to delete build binaries (inside XCode>Derived Data folder), restart Xcode and take fresh build.

Does anyone knows whats wrong with my environment?

More Details:
# I know this error is related to armv6 armv7 and mismatching device architecture. But as it works first time and stops working from second build onwards, means it doesn’t look like device architecture mismatch issue.
# If the project is not using cocos2d-x, then I don’t see such issue.
# Compiler: Apple LLVM Compiler 4.2

Any kind of help is very much appreciated.

Thanks

Hey did you ever find an answer to this? I just wasted three hours trying to get my project to run on iOS with no success. The vanilla project works fine, but the moment I add any code it starts complaining about the architecture just as you described.

Figured out the problem. I was adding resources by first removing the default Resource folder and then adding my custom Resource folder. Even when keeping the Info.plist intact this was making XCode angry. =P

Kevin H wrote:

Figured out the problem. I was adding resources by first removing the default Resource folder and then adding my custom Resource folder. Even when keeping the Info.plist intact this was making XCode angry. =P

I solved issue by recreating project using new Cocos2d-x binaries. I guess replacing only cocos2dx libs caused this issue.