24

My "Run" button under "Product" is greyed out and after trying a few things from various forums, can't figure out what's gone wrong.

I've tried removing the project.xcworkspace and xcuserdata files and letting xcode generate new ones, but no...

My co-worker uses AppCode from IntelliJ and when he pulls the code, it runs just fine. But if he opens the same files in his Xcode, his "Run" is also greyed out.

tshepang
  • 12,111
  • 21
  • 91
  • 136
FishStix
  • 4,994
  • 9
  • 38
  • 53
  • What is the XCode version are you using? And how long does it stay greyed out. What happens if you use keyboard shortcut Command + R – 0x8badf00d Nov 16 '11 at 01:15
  • XCode 4.2, Command + R does nothing, it's permanently greyed out – FishStix Nov 16 '11 at 01:20
  • What happens when you create a new project and Build + Run ? – 0x8badf00d Nov 16 '11 at 01:23
  • Other projects build and run just fine – FishStix Nov 16 '11 at 01:27
  • Can it do with the schemes? Are you sure you have a scheme that you know is the one you want? – SimplyKiwi Nov 16 '11 at 03:33
  • 3
    I had a similar issue with AppCode where I accidentally removed the product group and its content. It still worked in AppCode, but not in Xcode. The scheme and target settings were correct, but the "Run" menu item was grayed out and pressing the run triangle icon caused the code to compile, but nothing happened afterwards. Duplicating the app target and recreating a scheme for it fixed the problem. – Lukáš Kubánek Jul 11 '14 at 09:02
  • @LukasKubanek if only I had seen your comment a few hours ago :( duplicating target solved my problem. thanks. – emrahgunduz Nov 18 '15 at 20:53

4 Answers4

34

"Edit" your current "Scheme":

enter image description here

Make sure you have "Run" checked for that build target:

enter image description here

chown
  • 51,908
  • 16
  • 134
  • 170
17

The scheme need to be fixed (I don't know why xcode changed it)
Here are the required steps:
Goto project, Edit Scheme..., Change executable

Community
  • 1
  • 1
ShaulF
  • 841
  • 10
  • 17
5

Make sure you have the correct target selected.

(Upper-left in Xcode window, near the triangular Run button.)

funroll
  • 35,925
  • 7
  • 54
  • 59
4

My co-worker who uses AppCode had edited the configuration file, moved some frameworks around, etc... We noticed that there was a difference between XCode and AppCode in using relative vs. absolute paths in the project.pbxproj file.

Ultimately I just reverted the code to before his changes, so at this stage, I'm not entirely sure which difference in the config file actually caused Xcode to not be able to Run the project.

**EDIT From the .git logs, it looks like AppCode was adding relative directories with 7 sets of "/../" and before there were only ever instances of 5 "/../" to get back to the root directory. Rather frustrating that Xcode had no way of dealing with this from inside the IDE.

FishStix
  • 4,994
  • 9
  • 38
  • 53
  • 1
    same thing in 2015. somehow the scheme got corrupted and the executable ipa was unselectable in xcode. opening the project in AppCode and changing the executable for the scheme solved the problem. – emrahgunduz Nov 18 '15 at 02:03