duplicate device scheme in xcode 4 - xcode

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.

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)

Resetting Xcode's device/version list to run

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.

Xcode Instruments is stripping symbols despite all build settings to the contrary

Problem
Instruments' Time Profiler is stripping all symbols except system libraries from my app, despite the fact that I have disabled this behavior in all relevant build settings in Xcode — but only on one development machine. The other dev machine behaves normally.
Description
Instruments' Time Profiler is stripping all symbols except system libraries, despite the fact that I have disabled this behavior in all relevant build settings in Xcode — but this is only happening on one of my development machines. I have two development machines running the same version of OS X, Xcode, and Instruments, and each machine is using an identical copy of the same Xcode project with identical build settings, schemes, and other configurations, and the app is profiled using the same test device (iPhone 4S with the latest public version of iOS 5).
Machine 1
- Mac OS X 10.7.4
- Xcode 4.3.2 (4E2002)
- Instruments 4.3 (4321)
Machine 2
- Mac OS X 10.7.4
- Xcode 4.3.2 (4E2002)
- Instruments 4.3 (4321)
Steps To Reproduce
Open included sample project on each machine.
Make sure the iPhone 4S is selected as the test device.
Select Product > Profile
When Instruments launches, select Time Profiler and continue.
Run the app.
Notice how the symbols are stripped when running on the iMac (Machine 1) but not on the MacBook Air (Machine 2).
Expected Behavior
Symbols from my own code should appear in the Time Profiler on both machines.
Regression
I have tried all of the following, with no change in the actual results:
Rebooting the machine.
Trying other Xcode projects
Deleting the "Derived Data" for all projects in the Xcode Organizer.
Re-symbolicating the document in Instruments (carefully selecting the correct DSYM file in ~/Library/blahBlahBlah…)
Final Notes
Here is a link to a .zip file of a sample project: Sample Project .zip
I was finally able to get it to work by a method that's just shy of a nuke-and-pave scenario:
Make absolutely sure all symbol stripping is disabled for your current build configuration. Make sure you've done this for your Release config if that's what's being profiled for Instruments.
Delete the app from the iOS device.
Restart the iOS device.
Restart the Mac (I don't trust Xcode or Lion at all to quit all relevant processes otherwise).
Launch Xcode, go to Organizer > Projects and delete Derived Data for the affected project.
Clean your project. Hell, why not?
Build and profile for Instruments.
Choose the Time Profiler in Instruments for clarity.
The first run will not show the symbols, but don't quit. Leave Instruments running!
Re-symbolicate the document in Instruments, navigating carefully to the correct dSYM file for the current build. This should be easier since you've deleted the derived data in step 5.
Now you should be able to see your symbols. It helps if you hide non-objective-C symbols.
Why do I suggest that you delete the app and restart the iOS device in Steps 2 and 3? I have a suspicion that Xcode doesn't perform a clean installation of each build, but may install deltas, such that the symbol addresses present in Instruments are a mixture of the current build plus previous builds. If so, then this issue is even more common for someone like me, who shares a single test device between more than one Mac. This assumption could be wildly incorrect.
If the above steps don't work for you, please let me know in the comments. I'd like to create a detailed radar report at some point in the future.
I'm not sure that it has been fixed in the 4.3 but this is a known problem in 4.2 seen here
Instruments
There is a known issue with the Profile action from Xcode 4.2. After a build in which no source files have changed, Instruments will be unable to gather symbols for the target application.
This affects projects where both:
The Release configuration is selected for the Profile action.
(default)
The Strip Linked Product build setting is set to "Yes”, or
a custom Run Script build phase strips the product. (non-default)
The workaround is to do any one of the following:
Perform a "Clean" on the product before initiating the Profile
action.
Do a Clean of the product and temporarily set the Strip Linked
Product build setting to "No" while Profiling.
Set the configuration of the Profile action to Debug.
Run successive profiles directly from within Instruments when you do
not need to rebuild. When developing Mac apps, using the GC Monitor
template in Instruments may cause Instruments to crash. To
workaround the problem please consider migrating your application to
ARC.
I've had a similar problem for days. I was able to profile the Debug configuration, but not Release. First I tried to make a copy of the release configuration (as suggested somewhere on the web), but that copy did not work either.
Then I made a copy of Debug, called it Profile, tried it and the symbols of Profile were shown in the profiler. Great! I then changed the optimization levels etc. to the same as Release, and now it works! Just wanted to share this, as this comment would have spared me hours...
Have been facing the same and stumbled upon this thread.
I realized that I first profiled the app with release build and after changing the scheme in Xcode for the same app, the profiler was still unable to symbolize. I have tried all obvious solutions you mentioned above but in vain.
The profiler somehow is still referring to the first build (release build)'s settings and hence it is not able to symbolize. So, I just changed the app's bundle identifier for testing purpose so that a new app is created altogether for profiling purpose. I could check the code where leaks exist now.
Try it out and let me know if this works for you too. Still pondering over why Instruments is failing to symbolize though.
I had a similar issue where I had no symbols in my os x application that I built from the command line (so in this case it is not an iphone or xcode issue). It turned out the problem was due to a bad DYLD_LIBRARY_PATH that contained my PATH. When I got rid of all those non-library paths, such as /usr/bin/, it worked.
I have a lot of third party frameworks whose symbols and binaries are unfortunately getting lost.
Additionally, my app's binary was getting lost.
I.e. if I selected File > Symbols, clicked my target, and found the similarly named item, the Binary Path was showing up red.
The solution was to go to Instruments > Preferences > Symbols, and add /Users/<MY_USER>/Library/Developer/Xcode/DerviedData to the search paths. Library is not indexed by Spotlight. After doing this, I have at least had the symbols for my app. The little circle next to my app's name goes from Yellow to Green when I do this, and persists between restarting Instruments, unlike other solutions to manually set the binary.
Let me know if you can tell me how to get all the ones for my third party frameworks. I use Carthage for some, others installed manually. Have had no luck with these yet.
I've managed to solve this by:
Disconnecting the device
Deleting the iOS Device Support files for the device's version of iOS in ~/Library/Developer/Xcode/iOS Device Support
Reconnecting the device and letting Xcode reinstall device support.
To be safe I first quit Xcode and Instruments, deleted derived data, and did a clean build as mentioned above, but no need to delete the app or restart any devices this way.
Try open XCode 3 and him Organizer. And try add from this Organizer a devices to both machines.
Just open Organizer and wait him processes. If you're see a button "Use for development" then click him.
Sometimes, XCode 4 can't add a device a truely for full development.

Xcode Only Gives Me Desktop Architectures for iOS App

I have an iOS project that I've put in Dropbox to work with a few friends. The issue is that it seems to get "corrupted", so that after some time (after someone else has accessed the Xcode project file), when I try to go and open it again I get a Base SDK Missing error. In the Project Settings, I discover that I'm missing the valid ARM6/ARM7 architecture for iOS apps—I can only choose from 32-bit or 64-bit Intel. My only other options are i386, various forms of PPC, and x86_64. I simply can't build for iOS anymore.
No one else that I'm working with seems to have this problem. It exists in both Xcode 3 and 4, so it's not an Xcode 4 issue either.
Is anyone else having this problem? Is there a fix?
In these cases it's often a good idea to 'Clean All Targets'. I have found that particularly after upgrades to XCode where platforms or architectures have changed, that XCode can become confused about the state of previous builds. Cleaning, then re-specifying your desired targets/architectures/etc and then rebuilding will work well.
Also don't forget that if you hold Alt (or Option) down when you click on the Active build settings drop down will give you additional options.
Can you reinstall XCode? Also, it might be wiser to host the project under source control.
Hehe...turns out that the project had been used under the 4.2 SDK and at the time I only had 4.0, which explained the missing SDK part...Updated to 4.2 and it's all fixed now.
Source control would've been nice, but there aren't that many good ones that support the features we need (for free); if anyone's got a guide to installing Subversion on OS X and using it (without being too technical read Terminal), I'd appreciate that. Or how to set up Git with Xcode 4 (although I know that's under NDA, so that's probably not going to happen).

Why doesn't iPhone ad hoc distribution in iOS 4 (Xcode 3.2.3) work?

Before iOS 4, I could successfully build my app using the ad hoc distribution profile and send it to my clients for testing.
Now. under Xcode 3.2.3, when I (and my client) drag and drop the .app folder into iTunes, the app does not appear among the list of apps and no message (error, warning, etc) is displayed.
Is there a known problem with ad hoc distribution in Xcode 3.2.3?
Hey, so I just ran into this, and I found that I could fix it by setting the value:
"LSRequiresIPhoneOS" to true (checked) in the application's Info.plist file.
I had a look back at all my old projects, and found that they all had this checked. I'm guessing that what happens is that when you open an old iPhone project in Xcode 3.2.3, it corrupts that parameter for some reason. I also encountered another other weird thing when I opened the project: a build parameter that is iPhone specific ("iPhone OS Deployment Target") was not there, and instead, the parameter "Mac OS Deployment Target" was there. This issue was resolved by saving the project. It all seems to point to Xcode failing to be backwards compatible with iPhone projects, which I've definitely seen other manifestations of in previous SDK upgrades.
Anyhow, hope this helps! If anybody has any deeper insights I'd love to hear them.

Resources