Xcode 'Build and Archive' menu item disabled

Solution 1:

iOS Device is selected and Archive is enabled

Build configiuration setting needs to be an "iOS Device" (or any specific device if connected) to activate "Product → Archive" menu item. For some strange reason when any kind of iOS Simulator is selected, Archive is greyed out.

Solution 2:

in my case, the archive checkbox was unchecked. =/ strange

under edit scheme