[xcode] Xcode Product -> Archive disabled

I have been archiving for ad hoc distribution fine for many months and suddenly today I cannot do so as the Archive menu item is disabled. I have not changed anything. I went through the provisioning setup for the project and it looks ok.

My Ad Hoc profile is about to expire in 14 days. Could this be the problem? I don't believe I can renew it until the day it expires. There is a a "renew" button for my ad hoc profile in the organizer but when I click it I get...

The given profile was not found on the provisioning portal. Please refresh your provisioning profiles before attempting to renew “MyAddHocProfile”

The profile in the provisioning portal shows active, expiring on the 30th. I noticed that I had not yet upgraded to 4.6.2 and did so. Then I downloaded my profile and double cliked it thinking that would refresh the profile in Xcode, still no joy. I also tried manually replacing the profile file MyAddHocProfile.mobileprovision in the Library.

What do they mean "refresh your provisioning profile"?

Even so, I would think that as long as the profile is active, I should be able to create an archive. I must be doing something else wrong.

This question is related to xcode provisioning ad-hoc-distribution

The answer is


You've changed your scheme destination to a simulator instead of Generic iOS Device.

That's why it is greyed out.

Change from a simulator to Generic iOS Device


Select active scheme to Generic iOs Device.

select to Generic iOs Device


In addition to the generic device (or "Any iOS Device" in newer versions of Xcode) mentioned in the other answers, it is possible that the "Archive" action is not selected for the current target in the scheme.

To view and edit at the current scheme, select Product > Schemes > Edit Scheme... (Cmd+<), then make sure that the "Archive" action is checked in the line corresponding to the desired target.

In the image below, Archive is not checked and the Archive action is greyed out in the Product menu. Checking the indicated checkbox fixed the issue for me.

scheme settings


Change the active scheme Device from Simulator to Generic iOS Device


If you are sure that you selected the Generic iOS device and still can't see the option, then you simply have to restart Xcode.

This was the missing solution for me as a cordova developer with Xcode 11.2


Examples related to xcode

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 iPhone is not available. Please reconnect the device Make a VStack fill the width of the screen in SwiftUI error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65 The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Xcode 10: A valid provisioning profile for this executable was not found Xcode 10, Command CodeSign failed with a nonzero exit code

Examples related to provisioning

Xcode Product -> Archive disabled Xcode doesn't see my iOS device but iTunes does Xcode - iPhone - profile doesn't match any valid certificate-/private-key pair in the default keychain A valid provisioning profile for this executable was not found for debug mode Adding devices to team provisioning profile iPhone Debugging: How to resolve 'failed to get the task for process'? Renew Provisioning Profile

Examples related to ad-hoc-distribution

iOS8 Beta Ad-Hoc App Download (itms-services) Xcode Product -> Archive disabled