iOS project has changed to OS X project - ios

The house of cards that is XCode has changed my project from iOS to OS X.
It doesn't appear to have anything to do with the Schema because I've deleted that. In the build settings, the architecture settings are drawing from "OS X Default".
How do I change it back?
I fixed one of my projects by restarting the machine. One is still incorrectly configured though.
Many answers elsewhere suggest overriding the settings inherited from "OS X Default", which you can see in the following screen shot. Ideally the base settings should be "iOS Default".

Check and set your base SDK to iOS. Go to Project (in upper left) -> Project (project name in submenu) -> Build Settings. In Architectures menu select Base SDK as one of the iOS SDK.
Also, you said you deleted your Xcode schemes. That may also cause this. Try this:
On the left top corner of Xcode click on the scheme.
Click edit scheme.
In the new window change "Executable" from non to the name of your
project scheme "target".

Related

Impossible to run my Apple Watch application in iOS Simulator

I'm trying to run an Apple WatchKit target with my Universal app, using Xcode 6.2
I'm probably doing something wrong, but I can't access to the simulator in the scheme menu
Any idea ?
Have you tried to attach it in the iOS simulator?
This appears to be a bug that at times affects some Build Schemes for some reason. Fortunately, it is easy to fix.
In the menu that appears in your screenshot, select "New Scheme".
Select your WatchKit App as the target, and give it a name. Click 'OK'.
In the new entry in the Schemes menu, you should now be able to open your WatchKit app in the simulator.
You can also correct this issue via "Manage Schemes" and removing and re-adding your existing WatchKit App.
No luck?
For those who are still having a headache after doing this list of things:
Creating new schemes
Hacking Targeted Device Family
Autocreating schemes
Clearing Derived Data and Module Cache cleaning Project
Restarting Xcode, Mac
History
It took me about 3 hours to get rid of no targets (my case was My Mac target), I copied the project somewhere to keep my current data and I did these things to inspect:
Deleting current targets (AppExtension and WatchKit)
Creating them again (for my surprise the iOS Simulator this time came up)
Opening Product->Scheme->Edit Scheme
Selecting a scheme which target is WatchKit App
Under Build I see that my old scheme had only its own target (WatchKit one) while the new that was generated from new targets had 3 targets (MainApp, WatchKit and WatchExtension)
I did the same thing to my old ones by adding target, and the simulator came up, ran it and worked perfectly
Solution
Open Product->Scheme->Edit Scheme
Select your WatchKit Scheme
Select Build and if you see only one target, that could be the case, add the other required target (in my case were MainApp and WatchKit Extension)
If it works, cheers :)
Hope it helps somebody
This is likely the issue reported in the Xcode Release Notes whereby Xcode can't communicate with the simulator service if you rename Xcode.app. Please reboot your system.
Renaming Xcode.app after running any of the Xcode tools in that bundle
may cause iOS Simulator to be no longer be available. Either rename
Xcode.app back to what it was when first launched or restart your Mac.
(16646772)
If you open the Watch Kit project in lower versions of Xcode (6.1 and below) you wont get the simulator options.
Not sure if you have done the same, but I just observed this today.

Can't select iOS simulator in Xcode

I updated Xcode to the 6.1 version and now I don't understand why I can't select the simulator in the top left corner like in the previous version when I want to run my application. The only choice that appear is a general "iOS device".
Press "Window" and then "Devices", check if they appear there and if not - click the "+" icon in the lower left
Go to File -> Project Settings -> Info.
Change the deployment target to a lower or higher version.
Most probably you do not have a simulator installed for the current deployment target. You can do so by going to Xcode Preferences -> Downloads. In the Components section, you will see the options for downloading the simulators you already don't have.
Faced the same issue many times and found this solution. Hope this helps. :)
I finally found the solution. When I added a simulator in the devices menu (Shift+Cmd+2) I got this error: "Unable to determine SimDeviceSet, set_path=/Users/MyUser/Library/Developer/CoreSimulator/Devices"
I checked the directory and there was not the folder "CoreSimulator", so I created it. I restarted XCode and now there are all the iOS Simulators selectable for running my app.
Thank you all.
I suspect that you are having issues communicating with CoreSimualtorService due to renaming Xcode.app or similar. This is mentioned in the Xcode 6.0 and 6.1 release notes. Unfortunately, the only workaround at the moment is for you to rename it back or reboot.
Update:
Note that for current (as of this update) versions of Xcode (7.2+), renaming should work ok. For best results, only use one version of Xcode at a time. If you start another version of Xcode while one is running, the previous one will loose access to simulator devices. Restarting it will cause it to have access to the simulator devices (and of course the other one to stop). Basically, the last one wins.
I experienced same issue.My OS is 10.9.5. I solved this issue by downloading IOS simulator 7.1 from Xcode Preferences -> Downloads -> iOS 7.1 Simulator.
And then Windows -> Devices -> added simulator devices by clicking +.
Thanks.
Go to Window -> Devices and Simulators, check whether there is any Simulator listed. If no, add by clicking over "-" over the lower left corner. Or if devices are there but you are not able to see them in devices to be choose from, then check for deployment target that might not be compatible with Xcode simulators, set target according to your Xcode support and you will see the simulators list.
in my case, after delete xcuserdata from my folder, then simulate only have my mac without any other options. after search, I found in scheme setting, Run->Info->Executable without any app. Then I select my app in the project. then simulator all come back.

Xcode: how to test my app on older versions of iOS

I would like to test my app on older versions of iOS. By "older versions" I mean iOS 5.1 5.0 and 4.3. In order to do so, what should I do in Xcode? I've already downloaded (through Xcode) all the corresponding simulators, but I don't know how to build and run my app on a specific simulator. The only choice I have is to run my app on iPhone/iPad 6.0 simulator.
Thanks.
Both of these answers weren't clear enough, I'm adding this to stop people making incorrect assumptions.
The only way to test on a lower version of the iOS is to run it on a device with the lower version or on one of the lower version simulators.
The "Deployment Target", which both answers here incorrectly say runs the app on a lower version, just sets the minimum installed OS version that the app will run on. When you run it on the iOS 6 simulator - it is still running on the version 6, not to whatever your deployment target is set at.
But, without setting a lower deployment target, the option to use a different iOS Simulator isn't available.
Best practice is to build with the latest version and SDK available and set the deployment target to the lowest version that your app supports.
As for running the app on different versions of the simulator - have a look at the dropdown in the top left corner of Xcode - you can pick which of the installed simulators to run your app on from there.
I think your applications deployment target is set to iOS 6.0. Make it to the lowest version you want. I believe iOS 4.3 is the lowest that is possible right now.
To change deployment target,
Select project file in Project Navigation
Click your target
In the summary tab, choose your deployment target.
EDIT: After seeing #Abizern answer.
Well I answered to this part in the question.
The only choice I have is to run my app on iPhone/iPad 6.0 simulator.
OP was not getting older version of simulator to show up in the drop down menu. It was because his project base sdk target and deployment target was set to iOS 6.0. By setting deployment target to a lower version, other simulators started to show up.
But as #Abizern correctly pointed out, to run on a simulator of lower version you have to choose the correct simulator from dropdown menu to run. Well just to make it clear.
Open Xcode and in the menu at the top left, where you select what device to run on, click "More Simulators..."
The download section of Xcode preferences will open,
Click the "Components" tab.
You will see a list of simulators that can be installed, click install on version you need.
The simulator will need to restart to install.
To run the newly installed version of the simulator just select it from the run menu in Xcode.
At the sidebar left, click on the first element of the list(usually is the name of your project). A new menu will open, like my screenshot.
Just select the target that you want to simulate.

Xcode 4.4 turned my iOS project into a Mac OS X project! How can I fix this?

I've opened an iOS project - with Xcode 4.4.1 - that I hadn't opened for 2 months (ie with Xcode 4.3). First, Xcode was crashing constantly right after displaying the project navigator saying something like "Failed to associate working tree".
I tried to fix it by removing xcuserdata files and the project.xcworkspace directory as well.
Now, Xcode opens without crashing but in the scheme view, it is shown as a Mac OS X project whereas both the project and the target are correctly set to a "Latest iOS" base SDK.
How can I fix that without having to recreate a project and copy all my source files?
EDIT: i'm using Git with a GitHub remote.
make a new scheme for ios by clicking on the current scheme then "new scheme"
Roll back using version control. If you post which version control system you are using, somebody will be able to give you the specific command to use.
I had a similar problem with all my Xcode projects. Every iOS project got turned into an OS X project without me changing any settings. A reinstallation of Xcode fixed it for me.
Just set your Root SDK to iOS in your target's Build Settings
SDKROOT = iphoneos

Xcode iOS Base SDK Missing

I have an old iOS app that I never distributed and am now trying to work on the project again. It worked fine with an earlier version of Xcode but I was not ready to deploy it at that time. Now I am using the current version of Xcode but I have an error that there is a missing base SDK. I have explored every posting here with that error message and they did not work for me.
On investigation in Xcode. I can choose my app under "Project" pane. With the Info tab chosen, it has under Deployment Target as "Mac OS X Deployment Target" and Default in the drop list.
This is an iOS app and not a Mac OS X app. How do I change this?
I already have the base SDK as the Latest iOS.
Suggestions?
Try this:
Open Xcode and Press cmd + 1
In left panel choose your project -> Your target in center panel-> Build Settings in right panel
Find "Base SDK" and choose "Latest iOS". If you see a Release and Debug lines, then choose this for both Release and Debug.
Restart your Xcode
Usually when you see this, it's when you've got an old iOS project and you're using a version of Xcode that uses a newer base iOS. In those cases, you can click on the target on the top of the tree structure of the Project Navigator on the left, and you'll see the project settings. There's a button labelled "Validate Settings" and will show up near the lower center portion of the main panel. Click on it.
If that doesn't do it (e.g. it's from a really old version and Xcode can't figure out how to remedy it), it might be easier to recreate the project. Create a new iOS project and then copy your source code, its NIBs and resources into that project. Maybe that will be easier than trying to fix the old project you have.

Resources