Xcode Product -> Archive disabled

XcodeProvisioningAd Hoc-Distribution

Xcode Problem Overview


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.

Xcode Solutions


Solution 1 - Xcode

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

Solution 2 - Xcode

Select "Any iOS Device" in newer versions of Xcode. And Archive Option will be enabled!

Solution 3 - Xcode

Change the active scheme Device from Simulator to Generic iOS Device

Solution 4 - Xcode

Select active scheme to Generic iOs Device.

select to Generic iOs Device

Solution 5 - Xcode

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

Solution 6 - Xcode

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser278859View Question on Stackoverflow
Solution 1 - XcodewiseindyView Answer on Stackoverflow
Solution 2 - XcodeC BaraliyaView Answer on Stackoverflow
Solution 3 - XcodeRabieView Answer on Stackoverflow
Solution 4 - XcodeFaisal MulyaView Answer on Stackoverflow
Solution 5 - XcodeMasterAMView Answer on Stackoverflow
Solution 6 - XcodeSteckdoserichView Answer on Stackoverflow