Unable to build using Xcode 4 - The selected run destination is not valid for this action - cocoa

So I'm horribly confused by this error, other threads on Stack Overflow mention I should set the SDK, but I see no option to do this. I'm trying to build:http://wafflesoftware.net/shortcut/
And I get no options, and I can only choose My Mac 64-bit, and I want it in 32-bit. Really beginning to hate Xcode 4.
Here is the screenshot when I try to edit my scheme: http://groovyape.com/scheme.png
Thoughts?

Firstly, I have observed that when Xcode 4 decides my Mac is 64 bit and all my other schemes have vanished, a restart of Xcode fixes that.
If you still have the issue after a restart, go to Manage Schemes... (under the Product Menu) and click on Autocreate Schemes now button. Try to delete the other schemes and see if you can run the project now.
However, if the issue is that you need to set the SDK, that's different:
Click on the top-level project icon in the left hand panel
In the right hand panel that appears, select Build Settings (near the top).
Select "All" option (instead of Combined)
Ensure Base SDK is set appropriately, like "OS X 10.7".
FWIW I'm seriously considering reverting to Xcode 3.2.5 at the moment, 4 seems horrendously buggy.

In xCode 4.4.1, use Validate Settings to solve the problem!
I can select either 32bit or 64bit now.

Ran into the same error message ("The selected run destination is not valid for this action") when attempting to use XCode 4 to build/run a tiny Objective-C "Hello, World" project I created in XCode 3.x. Fixed it by choosing to "Manage Schemes..." from the drop-down menu to the right of the Stop button, deleting the one scheme on the list (click checkbox beside the scheme, then click the "-" button at the bottom left), and then clicking "Autocreate Schemes Now".
I also needed to change the "Base SDK" from 10.5 to 10.6, by clicking on 'folder' icon (beneath the Run button), clicking the root/top of the tree view below it, clicking on the blue icon below "PROJECT" in the pane just to the right, and then finally, choosing "Latest Mac OS X (Mac OS X 10.6)" to the right of that.

I had this issue today. I found switching Base SDK from Latest iOS (4.3) to iOS 4.3 fixed everything.

This will happen if XCode believes your mac is a 64-bit machine, when really it's a 32-bit. If this is the case for you, simply click on your project icon from the far-left pane - it's the menu item that displays your project name next to a little blue icon. This should bring up a center pane that says "PROJECT" at the top. Highlight your project name, and the third pane should now show your build settings. The first item is "Architectures" which will allow you to specify if you are building a 32-bit or 64-bit application.

Kind of amazing that none of the answers here solved the issue for me, but I figured it out. Forget restarting Xcode, or using Autocreate Schemes, still only 64-bit will show up as a valid destination in the scheme.
The correct solution is to change the Architecture for your project. Go to Build Settings (in the root node of your project), and change Architecture to 32-bit Intel, it's right above the Base SDK setting. Destination will instantly switch to "My Mac 32-bit". HTH somebody.

It sounds as if you're trying to run (Cmd-R or run button) the framework (which you can't do - it's not an executable, just a library) rather than simply build it (Cmd-B).

I had this issue and maybe it was a coincidence but when I restarted XC4 but this time didn't choose to load my project from the popup window that appears on launch - instead choosing it explicitly from the File menu - the issue didn't occur and the build started ok.
On the 3 or 4 occasions I had this error, I had chosen to load the project from the popup window that appears when XC4 first loads.
As I say, I might have just got lucky, but I certainly didn't make any other changes to the projects to 'fix' the issue.

I found a good practice for moving from Xcode 3.2.X to Xcode 4 is, to remove any references to older SDKs (in the case of Mac OS to remove any Base SDK Ref, etc., for Mac OS <= 10.5, in the case of iOS I think you need to remove everything <= 4.3) PRIOR to upgrading to Xcode 4.
I never experienced any problems for new Projects, created in Xcode 4, only for such that where created with Xcode 3.X or 2.X

Xcode 4.5. I was trying to compile for 10.6. It seemed to be stuck on 64 bit just because it couldn't find the sdk. I didn't get any message about it not finding the sdk.
I first tried to put in the correct path to /Developer-3.2.6/SDKs/MacOSX10.6.sdk but xcode didn't want to find it there. Then I copied that folder into 4.5 next to the other OSX Platform sdk (new location I think just look in the bundle).
And magically my 32 bit came back.
So my conclusion is that the 32/64 bit option is really dependent on whether xcode can verify the sdk that you're trying to use. Being stuck at 64 while trying to compile for 32 gives the error without notifying you that its first issue is that the sdk can't be found.

I fixed this by deleting my xcuserdata in my Project file. Not sure how it got corrupt. But it worked for everyone else in the office, deleting the xcuserdata did the trick. I made sure Xcode was closed while doing so. Just for fun, make sure you delete your DerivedData folder for the app, and do a build clean for superstitious folks.

If this happened after you renamed your app, go to Schemes -> Edit Scheme -> Run <YourApp> -> Info
Select the right executable file (YourApp.app)
Another way is to select None as executable and then reselect the YourApp.app from your Debug-iPhoneOS folder.

Related

XCode does not open at all on Mac Mini

I bought an M1 Mac Mini recently and tried to use XCode on it, but it does not open at all.
I tried re-install it and delete ~/Library/Developer directory, it seems nothing works.
This is my first Mac device and if I give more detail about what I mean by 'does not open at all' - it does nothing even if I double click the XCode from Applications directory or the bar at the bottom that has other installed applications showing on it(sorry, I don't know how this is called).
I can see the little grey dot under the icon which means it is running somehow, but nothing comes up on the screen. Then the grey dot goes away after few minutes with nothing happening.
How do I resolve this problem?
Making sure that the application itself is in the right place would be my first approach. Did you download Xcode from the App Store?
Here’s a link to someone with the same issue asking on the Apple developers forum
https://developer.apple.com/forums/thread/101265
Go to applications folder, right click, "get info" and then “Open using Rosetta”. Check the box.

WidgetKit on Mac with Intent doesn't work

I am trying to make a WidgetKit widget for macOS Big Sur. The widget itself works -- the same code on both the Mac and iOS. The issue is that on the Mac the intent (settings) does not work. When I click "Edit Widget" the options I defined do not appear. When I press "Done," it's replaced with a screen that says "Unable to load."
This seems to happen with a brand new target and just a simple new text parameter. These are the steps I took:
Create a new Mac project
Add a new Widget target
Change the generated Intent, adding a parameter. You also need to add a "Siri Dialog Prompt"
Click "Run"
Click "Info" in the Widget Simulator
Click "Configure Intent"
Am I missing something or is this a bug?
This has been an issue since at least Big Sur beta 5 and Xcode 12b6. I opened a ticket with Apple, but I'm also asking here as it seems that some people have it working and it's entirely possible that I'm missing something!
This seems to be a bug of the Widget Simulator. When I run the same Widget in the Widget panel of Big Sur, I see all configuration options.
The problem turned out to be an older copy of the app on my disk and macOS getting confused and looking in the wrong place.
I'm adding a Widget to an existing app that doesn't currently have one. I have the current, App Store version in /Applications. I've been running the updated version from Xcode or exporting it to my desktop and running it from there. The Widget itself -- as noted in the question -- runs just fine. But it seems that when looking for the Intent used for the configuration, it prefers to look in /Application rather than the Xcode version. As soon as I deleted the original app, the widget and its settings immediately started working.
Thanks to Ely for pointing me to this blog which didn't give the answer but pointing me in the right direction.

Destination toolbar disappeared on XCode 6.4

Today in the morning I tried to compile my project to run in my device and I found the destination toolbar disappeared and I cannot choose my IOS device or IOS Simulator device as target. (I can do it in the Product/Destination Menu)
After some research I found the >> at the right on the screen and when I pushed a Scheme option appeared but it is disabled and I can't enable again.
This is what I tried with no success:
Open an old project to see if the problem was in my project
Create a new project (with Swift and Objective C but I don't think this make any difference)
Restart my computer
Hide and show the toolbar (View menu/Hide Toolbar and the View menu/Show Toolbar)
I tried all the previous options with the device connected and disconnected
I have installed the IOS Simulator 8.4 (when I run my project it runs in the last selected simulator) and XCode 6.4.
Looks like Xcode hides that menu when the window is a certain size. I have to make my window quite large before it comes back.
Not a fix as such but you can work around it using the menus: Product > Scheme and Product > Destination
You're probably running into the same issue I am. Like #BrandonWilliams said in his answer, it appears again if the Xcode window is wide enough. The underlying cause, for me at least, seems to be that in this build of Xcode (6.4) running on El Capitan beta 2 (with Xcode 7 beta installed), I am seeing duplicate simulators for iOS 8.4. And since there are two of the same version, the Schemes dropdown shows some sort of long GUID next to each one, causing the Scheme dropdown to be quite large:
I came to SO looking for an answer but realized that I had seen this issue before.
So the problem is basically that auto layout sucks (I mean it is not working properly in Xcode 6) and on El Capitan, the destination toolbar is for some reason hiding instead of collapsing properly. So when your Xcode window is narrow, the destination toolbar disappears.
But, if you expand the window far enough, it shows back up again.
In case you can't tell, in the first screenshot, the window is about 1241 pixels wide and in the second screenshot the window is 1541 pixels wide.
Go to Product then Destination and choose at which simulator or device you want to test your build.
I'm running with same problem. You can select device or change scheme using below steps:
Select Product from menu
Select Scheme or Destination
Select required Scheme option or Destination option
Alternative Solution:
The only solution is to use Xcode 7 or above. I've installed Xcode 7.1 and found Scheme/Simulator list available. Refer screenshot.
It seems that Xcode 6 or below doesn't support OS X El Capitan.
I am still seeing this problem in Xcode 7.2 on iMac with resolution 1920x1080. Resizing the XCode windows dens't help. I can have the menu bar back if I push the green button and go to full screen mode. But that's pretty annoying. This is how I finally figure out a solution that works for me. I notice that only if I open the project file that I have been working daily that the menu bar is missing. If I create a new project, the menu bar is there. And here is my solution:
Remove your project file on disc (or move it to a different folder)
Open the Welcome to Xcode window by shift+command+1
Make sure your project is no longer under this list. If it is still there, click on it and Xcode will tell you the project is not found and it will be removed.
Add the project file back and open it and I have my menu bar back (if you have moved it, simply opening it from a different file location may work I guess)
I guess the problem is that some cache value in Xcode about the project file is messed up somehow. Hope this helps.
I make my XCode screen little big and now find both options.
On XCode 9.0 beta, this worked for me: select View -> Show Toolbar from menu
right click on title bar -> select show toolbar
Fixed it by deleting the following file ~/Library/Preferences/com.apple.dt.Xcode.plist and restarting Xcode.
The downside is that Xcode preferences dropped to defaults obviously.

Cannot find executable for CFBundle CertUIFramework.axbundle

Just updated to Xcode 5 and this is the first error its throwing on the logger for all my apps. Can't seem to understand why this is happening.
2013-09-19 10:46:54.341 MyApp[1156:a0b] Cannot find executable
for CFBundle 0x8a7c7a0 </Applications/Xcode.app/Contents/Developer/Platforms/
iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/
System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
Edit (11-11-2013): To everyone reading, once I waiting for a solid working solution to accept and close. The highest voted answer works until you re-open the project only.
Edit (30-09-2014): I can see this has been sorted since XCode 6 has been released! Finally
Final Edit-
Temporary workaround: click iOS Simulator > Reset Content and
Settings... and run again.
This error message may reappear at random. For me, it happens when I
launch a different application. There are several threads in Apple dev
forums and in StackOverflow about this problem, but none have a
definitive answer. This seems to be a SDK error to be fixed in the
next Xcode version.
Updated: October 3.
CREDIT - Please check this answer - Xcode 5 Error CertUIFramework.axbundle
Further Edit
Although this was potentially the issue resolution at the time. I believe some of the newer answers below relating to the better touch tool are in fact the correct resolutions.
After reading Kirill's answer I did some digging as I didn't want to disable BetterTouchTool for everything just the "iOS Simulator" and you can.
Open the "iOS Simulator" and will it as the active app go to the BTT drop-down menu from the top bar (of that screen if you have more than one) and select "Disable BTT for Current App". It will turn to a play icon when it's disabled.
Make sure the app name on the bar is still "iOS Simulator" as mine jumped to "Finder" a few times when I clicked the top bar!
Now re-set the simulator (if it doesn't work) and rebuild. You shouldn't get the error! :)
Don't forget to clear the error if it's still there. ;)
BTT seems to remember what apps it's disabled for (or at least it does when you close and re-open the app that's disabled I haven't tried a system re-boot yet).
Its easy. Go iOS simulator and reset content and setting.
Thanks
If you are using XCode-5 then just reset the simulator "Reset Content and Settings" and run once again
So I was having this error too in Xcode 5 and 5.1. I wanted to figure out if it's Xcode bug or something else, so I did a fresh install of Mavericks 10.9.2 and Xcode 5.1. Everything seemed fine after multiple tests.
Here is where the problem began. I put the apps and settings that I mostly use and the error came back. So I deleted everything and started adding everything one by one. After couple days I had bingo! The problem is with BetterSnapTool and BetterTouchTool
Update 12.12.2014
Just started using Xcode 6.1 and noticed that this bug seems to be gone at least with Xcode 6.1 simulators and BTT 0.9985 versions.
Update:
As GasB pointed out, it is possible to disable BTT for certain apps. So just disable it for iOS Simulator. You just have to remember not to use gestures while using the simulator as that triggers the error message.
Simple solution:
Remove the ticks in preference pane, reset simulator and do clean build. The error message will disappear.
.
I had the same problem and solved it setting the 'Localization native development region' to match my systems region. In my case from 'en' to 'de'. The referenced files are stored in localized versions in your filesystem. So this setting is used to identify the needed version.
You can find that setting in your project settings at 'Info' -> 'Custom iOS Target Properties'.
Resetting the simulator ‘fixes’ it because it turns the accessibility support off. You can normally achieve the same by simply disabling the ‘Accessibility Inspector’ in the ‘Settings’ app.
If, however, you need it enabled, particularly hate this error message, and are feeling adventurous then you can use the following monkey patches to silence the error: https://gist.github.com/alloy/9277316. (Be sure to NOT include this in your release builds.)
Resetting the simulator is a PITA, I found a way to get rid of these messages without having to to this:
go to Settings > Accessibility
turn on Accessibility Inspector
turn off Accessibility Inspector
quit Simulator
I had this problem with Xcode 5 in ML 10.8.5
I re-installed Mountain Lion (in a Parallels' VM), then update ML to 10.8.5.
Then installrd Xcode 5, and it's worked fine.
I think that the error is caused by a third SW installed in ML.
The application Moom is also causing this issue, and I couldn't find a way to disable it for just the iOS Simulator. So for now I disabled it's accessibility features.
I'm on Mavericks (10.9.3) and encountered the same error in xCode(5.1.1).
I tried anything - reinstalling xCode from both AppStore and dmg. Resetting the emulator resulted in the same error and deleting the Simulator SDK folder gave no results too.
The issue on my end was indeed Moom as mentioned by #aorcsik! Disabling it's accessibility, followed by clean (cmd+shift+k) in xCode cleared the error.
Open Disk Utility and apply Repair Disk Permissions in Macintosh HD.
After doing above step, apply Reset Contents and Settings in iOS Simulator.
This above solution can definitely fix your problem.
I had this problem, and none of the answers in this thread could fix it. Mine was simple UI with a UIDatePicker. I resolved it by removing the UIDatePicker and the associated code, then added them in again. Problem solved!
For me it was Keyboard Maestro, adding the simulator to Maestro's exclude list silenced the warnings

How did my Xcode project get changed from iOS project to an OSX project?

I've been doing only iOS development and never made an OSX app. In the iOS project I'm working on now I see that suddenly Xcode thinks it's an OSX project. The all my framework files are shown in red (missing), and lots of the options in the project panel show choices that are only appropriate for OSX such as "deployment target", which offers only 10.4, 10.5, 10.6 etc. and in Build Settings the Valid Architecture shows i386 x86_64 with no drop-down options.
What happened? How can I change this back to an iOS project?
could be 2 late to answer this question, however, this answer might help someone in the future, as the above answer wasn't helpful for me, so here is what I have done.
1- on the left top corner of Xcode click on the scheme.
2- click edit scheme
3- in the new window change "Executable" from non to the name of your project scheme "target"
4- on the top where it says "My Mac 64-bit" if it didn't changed automatically to iPhone/iPad change it manually.
5- if there wasn't any option, in bottom of the window click "Manage Schemes" and make sure the
check box next to your project scheme is checked.
hope this could help and save anyone time.
By your comment you should not have an issue navigating this.
Go to your Project (in upper left) -> Project (project name in submenu) -> Build Settings -> under Architectures menu select Base SDK and choose iOS 6.1.
This should switch your project back. Now under Info you should see your Deployment Target options have switched from saying OS X Development Target to iOS Development Target
As for why it originally changed, I have no idea. But hopefully this will fix your issue.
I know this is an old post, but this just happened to me in a project with multiple targets.
I'm using github and it had marked one of my target scheme files with a merge block at the top of the file after using a newer compiler. I could find a way to edit the scheme through XCode, but upon re-opening the project, it would be bad again.
I had to edit the file manually and complete the merge edit.
This recently happened to me with Xcode 8 where an old iOS project was turned into a dual destination macOS / iOS one.
To fix the issue I changed the Base SDK under Project -> Build Settings to Latest iOS (iOS10) and the change rippled through removing the macOS destination.
I fixed this by deleting the scheme showing issue and recreate it. This time it gets created as desired scheme type showing all the simulators and devices attached, if any.

Resources