Resetting Xcode's device/version list to run - xcode

I want to test/run my app on different iOS versions in Xcode, but somehow I can't see any option to change iOS simulator version (I have both 6 and 7 SDK/Simulator installed) in run targets. I'm also seeing all of my attached devices twice (I have only ONE iPod, but when I connect something else, they all display twice):
There's probably a bug with the device list of Xcode. How can I reset this list? I've tried resetting the scheme, but scheme is project related anyway. The problem occurs in all projects, not only a single project.

First of all, you have to install the 6.1 Simulator.
After that, you can choose which simulator version to use:

I've figured out the problem. I was on the "Latest iOS SDK" which was 7.1 SDK (I also have XCode 5.1DP installed). I've changed the base SDK to 7.0 and I am again able to choose. I still have two entries for each physical device but I can live with that.

Related

When I attached my device to the xcode and try to build my project it's generating error

Could not locate device support files.
This iPhone 5s (Model A1457, A1518, A1528, A1530) is running iOS 10.3.1 (14E304), which may not be supported by this version of Xcode.
You need to update Xcode whenever the iOS version you want to work with is higher than the highest version that Xcode's simulator has installed. This can be done one of two ways. The simplest is to use the App Store to download/update Xcode. If the App Store doesn't show any updates, you must manually download the latest Xcode build from https://developer.apple.com/.
You will need to manually download from the Developer portal when the version of Xcode on your computer was downloaded there previously. For example, many beta testers may download the file directly instead of using the Mac App Store, since it is a beta download.
I would recommend trying to keep updates done through the App Store by downloading Xcode from there initially. The benefit to this is that it can automatically update as well as save space on your computer (Xcode is a big file, and you may not have enough space to download a new version if you still have the old version).
As of the comments, I will now write an answer. :-)
Whenever you encounter this error there might be two reasons for that:
The OS version is too old
The iPhone's/iPad's OS is too new for your Xcode version
If it is too old, you may need to download older SDKs and OS versions.
You can do so in Xcode. Go to "Preferences" -> "Components" and download the appropriate Simulator.
If the devices OS is up to date, you have to make sure your Xcode is also up to date.
Either you update Xcode through the AppStore OR (and I prefer this way, as the AppStore is used to hang up in a certain state and cannot be completed any longer until you restart the Mac, at least I had this several times).
Side note: Xcode requires multiple GB of free storage. Make sure you have enough free storage left for an update.
You can download the latest Xcode version from the https://developer.apple.com portal:
Go to Downloads:
And then select the item of interest (in your case Xcode)

Xcode 4.4 - There was an internal API error

Hi I just upgraded to Mountain Lion. I created an empty Single View Application and run it. The first time it runs fine but the next runs will give me the "There was an internal API error" pop-up warning TWICE. It's the same with my other projects. They run okay once but gets this error the next runs. There was no warning or any specific warning message of any kind.
Any idea how to solve this?
Would really appreciate your help.
I have it working on iOS6 Beta 4!! This is what I did but other variations may also work:-
Install XCode 4.5 Developer Preview 4
Delete your app from the device
Run your app from Dev Preview 4
Delete your app again (not sure if you have to do this)
Return to XCode 4.4.1
Run your app, stop running, run again!!!
Of course you could continue developing in 4.5, but I prefer to wait.
Installing 4.5 Beta 4 installs updated device support. Once this is done once (possibly on any device) it should work fine. If you use the same device on a different machine you will have to again run it once from 4.5 Beta 4 before using your preferred version of Xcode (You do not need to delete the app from your device this time).
Edit: I am pretty sure that if you make a change to your core data you will need to run from 4.5 for the first time also.
Don't know if this helps, but I've deleted all files in ${HOME}/Library/Developer/Xcode/iOS DeviceSupport and it worked as a charm (Xcode 4.4.1, OSX 10.7)
I had this problem when I upgraded my device to Preview4 but had my MBP still running Xcode Preview3. Updating to Xcode Preview4 made the problem go away for me, no restarts necessary.
Deleting the app manually from the device/simulator will allow you to build and run successfully. A long term solution is to not use a Beta Xcode :)
Sounds crazy but you can also not use the Beta version of XCode 4.
However, you must keep it in your left hand to authorize your iPhone to compile with the non Beta version (don't ask me why, it works).
If you run your app with XCode 4.5 preview & IOS6 Beta 4, the second time you run your app on the device, you'll get the internal API error.
In theory, you cannot use XCode 4.4 to compile on your iOS6 Beta 4 iPhone.
But...
It seems that, if you launch XCode 4.5 Preview, connect your iPhone (so it is recognized), run the application on it (even if you get the error), quit XCode 4.5, launch XCode 4.4 and .. tadaaaa... your iPhone is now recognized as an authorized device to compile on...
And of course, XCode 4.4 doesn't generate the api error...
I have Xcode 5.0.2 and iPhone with iOS 7.0.6.
Every time when I launched my project on iPhone, I saw "There was an internal API error". And it was launched on simulator without any problems.
I did all the stuff that usually helps (like remove an app, clean, restart Xcode, restart a mac, etc.).
This problem went away only after I restored the iPhone. Sad but true.
I don't know so far, why it appeared.

duplicate device scheme in xcode 4

When I look at my schemes in xcode 4 after I connect my iPad, I see two schemes listed for my device (one to the right of my project name in the drop down list, and one right underneath it). I don't see any discernible difference in the schemes when I select Edit Scheme, but when I try to build the topmost one, I always get errors such as:
Cannot find protocol declaration for 'NSXMLParserDelegate'
Does anyone know why there are two device schemes or why the topmost one gets errors like the above one (but not the second one)?
I had the same problem. I found two SDKs in my Xcode.app:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/
iPhoneOS4.3.sdk
iPhoneOS5.1.sdk
I delete an old SDK iPhoneOS4.3.sdk, now everything is ok.
These device entries were actually labelled in some previous versions of Xcode as -
(your device) overriding base SDK to iOS (device iOS version)
(your device) with project settings
Xcode is displaying a device scheme for each of the iOS SDKs you have on your system.
If you want to remove those duplicate devices, you can either delete or move old SDK versions out of the system folder they reside in -
MACHD/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/...
Delete or transfer the old SDKs and relaunch Xcode to notice the updated device schemes. I'm not sure if you really want to be removing those SDKs... but that will get rid of those extra duplicate devices.
I had the same problem with an Xcode3 project when I upgraded it to Xcode4. I would have 5 "device" entries appear for each device I connected, but only the bottom-most one in the list would actually build successfully. I couldn't find any combination of settings that would resolve it, so I exported the scheme (which looked fine), deleted it, and let Xcode generate a new one. It's working fine now, so it must be some issue in the migration path.
I had the same problem (iPhone showing up twice when connected). What did work for me was: uninstalling all dev tools using
"sudo /Developer/Library/uninstall-devtools –mode=all"
Then reinstall XCode. Be careful though, the App Store will say, that XCode is already installed, so I ran the "Install Xcode" app in Applications.
Also see Why does Xcode create nonsensical destinations in every scheme?
The orginal question was posed on an Apple mailing list (http://lists.apple.com/archives/xcode-users/2011/May/msg00148.html), but the answer is easier to read from the above site.

Xcode: must re-download all of Xcode to get iOS SDK? [duplicate]

Silly question - Is there a way to download the iPhone SDK without Xcode when Apple releases an update?
As far as I understand you cannot download the SDK separately - and even if you could, I wouldn't recommend it. Using the bundled SDK+Xcode release is the best idea in my opinion, as it will be working for you out of the box. I know it's annoying having to download such a large amount of data for an SDK (not all of us have 100mbps pipes to play with!) but for ease of development, it's the way I'd recommend you go.
For those who have installed Xcode but do not have the iOS SDK, here is the way to download it without re-downloading Xcode:
Got to
Xcode > Preferences > Downloads
and select whatever you want to install.
Yes, contrary to what others say this is somewhat possible.
Method One
With this method you can download any iOS or OSX SDK and install it to XCode.
Download the desired SDK, bundled with XCode, from developer.apple.com/downloads
Once the package is done downloading mount the disk image. Right on the XCode application in the image and click on Show Package Contents. Navigate to:
/Contents/Developer/Platforms/
the iOS SDKs are in:
iPhoneOS.platform/Developer/SDKs/
the OSX SDKs are in:
MacOSX.platform/Developer/SDKs/
and the iOS simulator SDKs are in:
iPhoneSimulator.platform/Developer/SDKs/
To install one of the SDKs simply find XCode.app and place the SDK in the appropriate folder of the XCode.app package.
Method Two
With this method you can only dowload iOS simulators and iOS simulator SDKs.
Open XCode and in the menu bar click on XCode > Preferences. In the preferences dialog select the downloads tab and select the simulators you would like to dowload.
Unfortunately, no. Apple only provides the SDK as a bundled package.
They quite often include fixes and updates in the bundled version of xcode. I guess this is a good way for them to "force" people to use the latest point release of xcode.
The answer to the question being asked is, I think, that it is not possible. However, there is a highly related question (with a more interesting answer), how to use different/nonresident iOS SDKs with a particular version of Xcode? This does require downloading some other Xcode (to gain access to some other iOS SDK).
This issue has been a passion of mine for approximately the last 10 years, since I enjoy the stability of (or, at least, predictability of known misbehaviors in) a familiar IDE (i.e. Xcode) version. I last investigated the solution to this issue 3 years ago, and it was slightly more involved than the solution from 5 or so years before that. Here are my notes, from 2017:
SDK
What the development environment treats as the target device, e.g. compilation, IDE behaviors like displaying interface definitions/headers and code completion).
The "Base SDK" (in the "Build Settings" of a target in a project, which is possibly contained by a workspace) setting defaults to "Latest iOS", which resolves to a specific iOS version based on the contents of the Xcode app package directory
<app-package>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
A version of the Xcode application will ship (via Mac App Store or a disk image from developer.apple.com) with only one SDK. The above path will contain a directory named iPhoneOS.sdk and an alias (symbolic link) targeting this directory that is named according to the SDK version (iPhoneOS10.0.sdk -> iPhoneOS.sdk)
No application-provided means (i.e. preference of other UI affordance) for altering this characteristic.
While the plural form of the directory name (SDKs) seems like a vexing/mocking choice, you can modify the contents of this intra-app-package directory to include symbolic links to SDKs contained in other versions of Xcode.
This appears to only work in the forward direction, i.e. using a newer SDK in an older Xcode (e.g. iOS 10 SDK in Xcode 7). This direction has always met my historical needs. Only recently have I attempted to go backwards (make a newer Xcode use an older SDK, e.g. iOS 8.4 SDK in Xcode 7), and I discovered that recent Xcode installs (versions 8.0 and 7.3.1 on a 10.11.6 system) ignore symbolic links to older SDKs (i.e. they do not appear in a target's Base SDK popup menu – screen shot of Xcode 7.3.1 ignoring the iOS 8.4 SDK symlink).
UPDATE (new details): I double-checked my home machine (which I had used for additional multi-SDK experiments) and found that older SDKs do appear in the Base SDK popup. Mysterious! This is a 10.10.5 system, running Xcode 7.2.1 (which ships with iOS 9.2 SDK), editing a different (non-iovation) Xcode project, and the iOS 8.2 SDK (from Xcode 6.2) will display in the popup. Obviously, there are numerous differences between the setup, and I have no idea which variables cause the difference in behavior.
MYSTERY SOLVED: Recent Xcode installs (the aforementioned versions 8.0 and 7.3.1) include a MinimumSDKVersion key in the …/iPhoneOS.platform/Info.plist file. This key appears to be set to the SDK that ships with Xcode (i.e. inside the app package), and, consequently, blocks Xcode from recognizing older SDKs. I was first keyed onto this minimum-version mechanism from the xcodebuild command-line tool, which was printing out, "Skipped SDK <sdk-path>; its version (8.4) is below required minimum (10.0) for the iphoneos platform."
Editing MinimumSDKVersion plist key (e.g. making it 8.0) allows for the display and selection of older SDKs!
The fact that Apple rigidly binds SDK version to Xcode version has always bothered me. Oftentimes, I would prefer to add an SDK to an existing Xcode install, rather than updating the entire Xcode environment simply to gain support for a new version of iOS. Admittedly, bringing everything along in lock-step fashion (app, tools, device and OS support) does seem like it should simplify support issues for Apple, and, perhaps, they believe this conjoined progression also simplifies things for 3rd party devs (no options to fret over, just update the app).

How to update iPhone SDK without having to re-download Xcode?

Silly question - Is there a way to download the iPhone SDK without Xcode when Apple releases an update?
As far as I understand you cannot download the SDK separately - and even if you could, I wouldn't recommend it. Using the bundled SDK+Xcode release is the best idea in my opinion, as it will be working for you out of the box. I know it's annoying having to download such a large amount of data for an SDK (not all of us have 100mbps pipes to play with!) but for ease of development, it's the way I'd recommend you go.
For those who have installed Xcode but do not have the iOS SDK, here is the way to download it without re-downloading Xcode:
Got to
Xcode > Preferences > Downloads
and select whatever you want to install.
Yes, contrary to what others say this is somewhat possible.
Method One
With this method you can download any iOS or OSX SDK and install it to XCode.
Download the desired SDK, bundled with XCode, from developer.apple.com/downloads
Once the package is done downloading mount the disk image. Right on the XCode application in the image and click on Show Package Contents. Navigate to:
/Contents/Developer/Platforms/
the iOS SDKs are in:
iPhoneOS.platform/Developer/SDKs/
the OSX SDKs are in:
MacOSX.platform/Developer/SDKs/
and the iOS simulator SDKs are in:
iPhoneSimulator.platform/Developer/SDKs/
To install one of the SDKs simply find XCode.app and place the SDK in the appropriate folder of the XCode.app package.
Method Two
With this method you can only dowload iOS simulators and iOS simulator SDKs.
Open XCode and in the menu bar click on XCode > Preferences. In the preferences dialog select the downloads tab and select the simulators you would like to dowload.
Unfortunately, no. Apple only provides the SDK as a bundled package.
They quite often include fixes and updates in the bundled version of xcode. I guess this is a good way for them to "force" people to use the latest point release of xcode.
The answer to the question being asked is, I think, that it is not possible. However, there is a highly related question (with a more interesting answer), how to use different/nonresident iOS SDKs with a particular version of Xcode? This does require downloading some other Xcode (to gain access to some other iOS SDK).
This issue has been a passion of mine for approximately the last 10 years, since I enjoy the stability of (or, at least, predictability of known misbehaviors in) a familiar IDE (i.e. Xcode) version. I last investigated the solution to this issue 3 years ago, and it was slightly more involved than the solution from 5 or so years before that. Here are my notes, from 2017:
SDK
What the development environment treats as the target device, e.g. compilation, IDE behaviors like displaying interface definitions/headers and code completion).
The "Base SDK" (in the "Build Settings" of a target in a project, which is possibly contained by a workspace) setting defaults to "Latest iOS", which resolves to a specific iOS version based on the contents of the Xcode app package directory
<app-package>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
A version of the Xcode application will ship (via Mac App Store or a disk image from developer.apple.com) with only one SDK. The above path will contain a directory named iPhoneOS.sdk and an alias (symbolic link) targeting this directory that is named according to the SDK version (iPhoneOS10.0.sdk -> iPhoneOS.sdk)
No application-provided means (i.e. preference of other UI affordance) for altering this characteristic.
While the plural form of the directory name (SDKs) seems like a vexing/mocking choice, you can modify the contents of this intra-app-package directory to include symbolic links to SDKs contained in other versions of Xcode.
This appears to only work in the forward direction, i.e. using a newer SDK in an older Xcode (e.g. iOS 10 SDK in Xcode 7). This direction has always met my historical needs. Only recently have I attempted to go backwards (make a newer Xcode use an older SDK, e.g. iOS 8.4 SDK in Xcode 7), and I discovered that recent Xcode installs (versions 8.0 and 7.3.1 on a 10.11.6 system) ignore symbolic links to older SDKs (i.e. they do not appear in a target's Base SDK popup menu – screen shot of Xcode 7.3.1 ignoring the iOS 8.4 SDK symlink).
UPDATE (new details): I double-checked my home machine (which I had used for additional multi-SDK experiments) and found that older SDKs do appear in the Base SDK popup. Mysterious! This is a 10.10.5 system, running Xcode 7.2.1 (which ships with iOS 9.2 SDK), editing a different (non-iovation) Xcode project, and the iOS 8.2 SDK (from Xcode 6.2) will display in the popup. Obviously, there are numerous differences between the setup, and I have no idea which variables cause the difference in behavior.
MYSTERY SOLVED: Recent Xcode installs (the aforementioned versions 8.0 and 7.3.1) include a MinimumSDKVersion key in the …/iPhoneOS.platform/Info.plist file. This key appears to be set to the SDK that ships with Xcode (i.e. inside the app package), and, consequently, blocks Xcode from recognizing older SDKs. I was first keyed onto this minimum-version mechanism from the xcodebuild command-line tool, which was printing out, "Skipped SDK <sdk-path>; its version (8.4) is below required minimum (10.0) for the iphoneos platform."
Editing MinimumSDKVersion plist key (e.g. making it 8.0) allows for the display and selection of older SDKs!
The fact that Apple rigidly binds SDK version to Xcode version has always bothered me. Oftentimes, I would prefer to add an SDK to an existing Xcode install, rather than updating the entire Xcode environment simply to gain support for a new version of iOS. Admittedly, bringing everything along in lock-step fashion (app, tools, device and OS support) does seem like it should simplify support issues for Apple, and, perhaps, they believe this conjoined progression also simplifies things for 3rd party devs (no options to fret over, just update the app).

Resources