Xcode Product -> Archive disabled

198,250

Solution 1

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

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

Solution 3

Change the active scheme Device from Simulator to Generic iOS Device

Solution 4

Select active scheme to Generic iOs Device.

select to Generic iOs Device

Solution 5

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

Share:
198,250
user278859
Author by

user278859

Updated on April 25, 2021

Comments

  • user278859
    user278859 about 3 years

    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.

    • rob mayoff
      rob mayoff about 11 years
      Product > Archive is only enabled when your scheme has a destination of “iOS Device” or an actual iOS device. Have you checked that?
    • user278859
      user278859 about 11 years
      Darn! That was easy. Thanks! Please post your comment as an answer so I can give you credit and mark this as ansered.
    • rob mayoff
      rob mayoff about 11 years
    • Mathijs Segers
      Mathijs Segers over 9 years
      Does that even make sense?
    • naz
      naz about 4 years
      Archiving a sim version is possible on the terminal. Looking forward to Apple to enable it in Xcode, since you need it when distributing XCFrameworks.
  • Matt
    Matt over 10 years
    Thanks for this, the perfect fix. Any ideas why this happens though?
  • wiseindy
    wiseindy over 10 years
    Well, it's just a guess... Maybe Apple wants you to actually test your on a real device before you actually package it for the App Store. Just a hunch :)
  • MattL
    MattL over 10 years
    @user278859 if this is the right answer you should mark it as such.
  • dgatwood
    dgatwood almost 9 years
    Thanks for the answer. That's so completely non-obvious from a UI perspective that it catches even those of us who have been building apps for many years off guard. Apple should at least float a tooltip or something when it is in that state....
  • wiseindy
    wiseindy over 8 years
    Yep. This was back in the iOS 6 days. Still applicable :)
  • Nicolas Janel
    Nicolas Janel over 8 years
    Si I cannot archive a ios product if I don't have an ios pluged on the mac ? I'm using a cloud access to a Mac, so I cannot plug a device on it...
  • JCutting8
    JCutting8 over 8 years
    I can't believe I spend over 6 months using xCode and this never was an issue with me until just now. Good solution, but just surprised how long it took for me to run into this problem given how simple the solution is.
  • Stefan
    Stefan over 8 years
    I guess this has to do with the simulator not being an emulator. This means the device simulator on OS X executes Intel processor code whereas the actual iOS devices are provided with ARM processor code. So, in order to generate ARM code, the code generation has to be switched to real devices which is done by selecting such a device as target.
  • redolent
    redolent about 8 years
    If your phone is not available, choose Generic IOS device
  • user1366265
    user1366265 almost 8 years
    Come on Apple!! show some indication as to why it is grayed out!!
  • Bernardo Dal Corno
    Bernardo Dal Corno over 7 years
    OMG... so much time wasted!!
  • Heshan Sandeepa
    Heshan Sandeepa almost 6 years
    voting second time :(
  • Altimus Prime
    Altimus Prime over 4 years
    I can't find the options in the screen shot given.
  • shauneba
    shauneba almost 4 years
    A few people have asked for the reason 'Archive' is disabled when a simulator is selected. I don't know for sure but I suspect it's because building for a simulator will compile the code for x86, whereas building for a device will compile for ARM, which the App Store requires.
  • vin shaba
    vin shaba over 2 years
    Xcode 13.1 uses this. Thanx