14

I've installed the XCode 4.3. I've seen that in preferences general tab, there is the "iOS device discovery" tab. Maybe it was there before too, but I just noticed now. So I've checked it, after this I can do anything, but the XCode crashes constantly when I try to access the organizer's devices tab.

Any clues for solution?


Update: I've deleted it and reinstalled it from the Mac App Store, but it didn't help


Update: I've submitted the bug to Apple, they marked it as duplicate and after this they closed both of them. So, I hope we will have a solution from Apple.

13 Answers 13

16

I can't take full credit for this. I found it here and added a little bit to the end that I needed in my case.

Create readcert.m with these contents:

#import <Security/Security.h>
#import <Foundation/Foundation.h>

void checkCerts () {
    OSStatus status;

    const void *keys[] = {
        kSecClass,
        kSecReturnRef,
        kSecMatchLimit
    };
    const void *values[] = {
        kSecClassCertificate,
        kCFBooleanTrue,
        kSecMatchLimitAll
    };
    CFDictionaryRef query = CFDictionaryCreate(NULL, keys, values, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);

    CFArrayRef results;
    if ((status = SecItemCopyMatching((CFDictionaryRef) query, (CFTypeRef *)&results)) != noErr) {
        NSLog(@"Failed to copy certificates: %d", status);
        return;
    }

    CFIndex count = CFArrayGetCount(results);
    CFIndex i;
    for (i = 0; i < count; i++) {
        SecCertificateRef cert = (SecCertificateRef) CFArrayGetValueAtIndex(results, i);
        CFErrorRef error;
        CFDictionaryRef vals = SecCertificateCopyValues(cert, NULL, &error);
         if (vals == NULL) {
            CFStringRef subjectSummary = SecCertificateCopySubjectSummary(cert);
              NSLog(@"Found a triggering certificate: %@", subjectSummary);
         }
    }

    CFRelease(results);
}

int main (int argc, char *argv[]) {
    NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
    checkCerts();
    [p release];

    return 0;
}

Then, compile it with:

clang -o readcert readcert.m -framework Security -framework Foundation

Then run it:

./readcert

It should output the name of the bad certificate. In my case, it was a certificate from a Linksys router. I deleted the certificate from my keychain, but Xcode was still crashing and readcert was still saying it was there, so I ended up executing this command.

sudo security delete-certificate -c Linksys_WRVS4400Nv2

I'm not sure where the certificate was coming from, I didn't see it in the login or system keychains, but after deleting it from the command line, everything was peachy again in Xcode.

6
  • 4
    Fantastic, thank you. This worked for me and the devices tab will load again. It found several certificates that weren't visible in the Keychain app, I had to use security find-certificate -Z -a -c mycert.example.com to find them. The -a flag prints all matching certs. The -Z flag prints the SHA-1 hash of the cert which can be used in security delete-certificate -Z <hash> if multiple certificates match when deleting by name.
    – RandomEtc
    Mar 13, 2012 at 18:26
  • not only did this work for me, but it worked in XCode 4. Also, had the exact same linsys issue. Thank you!
    – nycynik
    May 3, 2012 at 17:04
  • Obviously still a bug, as I find myself back here, following my own answer to find and eliminate a bad cert. Still works!
    – Fls'Zen
    Jul 17, 2012 at 2:22
  • 1
    Yay, this works. I had some trouble figuring out the compiling because I didn't have the Xcode command line tools installed, so make sure you have those installed, can be done in Xcode>Preferences>Downloads tab (at least in Xcode 4.4.1)
    – DonnaLea
    Aug 22, 2012 at 8:57
  • Organizer crashes on refresh, I ran readcert but it had no output, and Organizer still crashes: UNCAUGHT EXCEPTION (NSInvalidArgumentException): *** setObjectForKey: object cannot be nil (key: teamId) Everyone where I work updated to the latest xCode so no one can recreate the team provisioning profile because everyone's Organizer crashes on refresh. Mar 22, 2013 at 0:16
11

Same Problem here. I just created a new user on my system. With it I have no problem open the Devices in the Organizer Window.... strange...

Edit: I've deleted one certificate in my keychain that solve the problem for me. It was a certificate which was not trustful. Maybe this will help you.

Note that the "harmful" certificate might not be a development certificate or related to development/provisioning at all. Make sure to check for "Certificates", not just "My certificates" in Keychain. The culprit could be any certificate, like a company-signed SSL certificate etc.

8
  • I've sent a bug report to Apple, about this issue. I am going to try the things about certificates and in case it works I will report this too, I hope Apple will work on it. Feb 18, 2012 at 8:44
  • The certificates solved the problem for me. I've deleted one certificate and tried, and again delete, until I found the bad certificate. Feb 18, 2012 at 9:10
  • Believe it or not, this did it for me as well. I just deleted all invalid (untrusted as well) certs and finally on the last one, it stopped crashing!
    – Jann
    Feb 22, 2012 at 0:45
  • I am also having this issue. However, I have deleted all untrusted certificates and anything that even slightly looked like it might not be right, but Xcode still crashes when I go to the Devices tab (also when trying to do an ad-hoc build). Anything else I should be looking for?
    – DonnaLea
    Feb 23, 2012 at 5:02
  • 1
    update: anything that doesn't say "This certificate is valid" should be deleted. I had a certificate which I had specifically set as trusted, but it also needed to be deleted before Xcode would stop crashing. And make sure you select every certificate, not all show a red cross next to the ones with problems.
    – DonnaLea
    Feb 23, 2012 at 5:06
2

Same Problem. Not happy. I have a hard time believing apple released this in such a state. XCode has crashed at least 25x today on me.

0
2

I solved the problem. I don't know if its the best solution, but after five days I'm happy to have Xcode working again.

I solved the problem by doing two things. Resetting my Keychain under Lion and revoking my existing provisioning profiles.

So first, reset your Keychain under Lion (http://support.apple.com/kb/TS1544). This will make the Organizer launch without crashing.

Unfortunately, now you can't deploy your software because you killed all the certs in the keychain. So now you need to revoke all your developer certs (developer.apple.com/membercenter) and delete the provisioning profiles from your Organizer. Then tell the Organizer to refresh.

It will restore all your sick profiles, but will also create at least one healthy one.

The new version of Xcode tries to be helpful, and wants to handle all your cert needs for you. So bring up an Xcode project, and set code signing to the new provisioning profile. Compile, and everything will work again.

As I said, may not be the best solution, but deleting old certs from the Keychain and extra prefs files did nothing to help me. If all else fails, try this recipe and it will probably help.

1

Finally figured this out. The problem for me was with the my dev device and not XCode. I restored my device to the factory defaults. Now XCode won't crash when the device is plugged in.

Before I reset the device, I tried just deleting all the certificates on the device. However, XCode still crashed. That's the only other step I took on the device before reseting it.

3/22/12 UPDATE: Apple released a new version of XCode today. From the release notes:

Additional bug fixes and stability improvements

Hopefully this fixes the issue for most people.

4/11/12 UPDATE

I started to have issues again with XCode. A colleague suggested I clear out the XCode cache for my project, which was located here for me:

~/Library/Developer/Xcode/DerivedData/your_app_name-abunchofletters

Within that folder run:

rm -r *

XCode no longer crashes when plugging in my dev device.

0

and again here.. I noticed my iphone would wake up after these crashes - it syncs via wifi.

I thought it fixed the problem yesterday until I started work today.. I can't work like this.. I'm already looking for an alternative.

I can force it to crash Today (for something different from Apple) File > Open > And select the programming folder where all the work is..Boom! Every Time..

Bottom Line: No Apple App release expected Today...

2
  • In case you have any crash log, please send it to me, so I can add it to my apple's bug submission. Feb 23, 2012 at 0:02
  • Hey @InfinitePossibilities I'm having the same problem. Here is my crashlog: pastebin.com/wLhFEu4q
    – Casey
    Mar 15, 2012 at 14:27
0

Same here. Check out your the System logs. For me it seems to be a bogus USB connection. I see stuff like that in the logs (console app):

27.02.12 13:34:16,537 com.apple.usbmuxd: _SendAttachNotification (thread 0x7fff756c7960): sending attach for device xxx._apple-mobdev._tcp.local.: _GetAddrInfoReplyReceivedCallback matched.

And then 27.02.12 13:34:20,407 [0x0-0x6b06b].com.apple.dt.Xcode: garbage pointer stored into reachable memory, break on auto_zone_resurrection_error to debug 27.02.12 13:34:20,425 [0x0-0x6b06b].com.apple.dt.Xcode: Xcode(2099,0x114d85000) malloc: * error for object 0x7fef55278cb0: pointer being freed was not allocated

Interestingly right after that tere is a backupd process that tries to start the time machine backup. Maybe related - I'll keep an eye on it.

1
  • My bug submission to Apple is approved, so I hope there will be a fix soon. Feb 27, 2012 at 12:59
0

I tried removing certificates as others have suggested and even reset my Keychain. However this had no affect and opening the organiser always causes a crash/hang.

My fix was to remove some of the Xcode settings files. Specifically I removed the following:

~/Library/Developer/Xcode/UserData/IDEOrganizerWindowController.xcuserstate
~/Library/Developer/Xcode/UserData/IDEPreferencesController.xcuserstate
~/Library/Developer/Xcode/UserData/KeyBindings

The solution to this Xcode problem seems to vary, but I had not seen anyone else post this solution, so I hope it will help others. Remember I had gone through the Keychain reset before getting to this, so I'm not ruling out a keychain reset with this solution.

2
  • Tried this, still having issues.
    – theodorton
    May 23, 2012 at 4:12
  • I believe this is the correct solution when the organiser crashes when trying to display at all, regardless of what tab you try and access. Although the question is about the devices tab, if the organiser crashes often enough while the organiser is showing, it will eventually end up garbaging the window preferences file, and this is the solution in that case. May 29, 2012 at 10:04
0

This isn't a real fix, but if you open up Activity Monitor, filter for bash, and continue to close/force close that process, xCode will regain consciousness.

0

If above solutions dosen't work then try installing previous version of your xcode using time machine. Really it worked for, apple updates is creating problem.

1
  • this should be a comment on above solution Mar 19, 2013 at 13:54
0

I deleted all old certificates which were not trustful. Even after doing so, my Xcode 4.5 crashed while opening organizer.

Hard Resetting the Xcode fixed my problem.

  1. Fire up your terminal.

  2. Type "defaults delete com.apple.Xcode" and press "Enter." This deletes the customized settings set up.

    Sometimes if you have more than one version of Xcode installed the defaults bundle identifier could be different. You can check lists of bundles identifiers by allowing terminal to show possibilites by pressing Tab button.

  3. Type "rm -rf ~/Library/Application\ Support/Xcode" and press "Enter." This removes the configuration folders as well.

Now open up an Xcode and it will show you agreement page. In this way my Xcode worked as expected.

I hope it might be help to someone.

0

I tried all the above and couldn't, the solution I found was really simple:

Go to ~/Library/Developer/ , inside this folder has a folder Xcode, all I did was renaming the existent one and reopen Xcode, then Xcode created a new folder name Xcode and everything started to work again.

Hope that helps.

0

I had this same error on Xcode 5.0 whenever I went to the Devices tab. The solution was found by looking at Applications->Utilities->Console. It was attempting to write to a read-only device logs database which then meant it couldn't instantiate the object model (ORM) and context for that database. The crash description was "Cannot perform operation without a managed object context".

Removing ~/Library/Developer/Xcode/iOS Device Logs/* and ~/Library/Developer/Xcode/iOS Device Logs*.db meant that it recreated the (now empty) .db file on startup with the right permissions, and everything works fine now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.