tags:

views:

401

answers:

2

I'm getting the error "Assertion failed: (cls), function getName, file /SourceCache/objc4_Sim/objc4-427.1.1/runtime/objc-runtime-new.m, line 3939." whenever I run the following code.

NSLog(@"Hello: %@\n", [NSMutableString stringWithString:@"Whatever"]);

It also get about a thousand of the above error whenever I run this:

NSMutableString* urlCopy = [[NSMutableString alloc] initWithString:url];

and mouse over the urlCopy variable it in the debugger. Is it my version of XCode? What the hell is going on? I'm running 3.2.4 64-bit. I'm at a complete loss to explain this, and I can't seem to create any sort of String without this problem. I've written programs where this is the only line in the program, and it still creates this error. Please help!

+1  A: 

I'm also using 3.2.4 64-bit, and your code (the NSLog call) works fine for me. If it's happening with every project, sounds like there must be something wrong with your environment. Have you tried reinstalling Xcode?

zpasternack
Alright, I'm gonna try that, and see how it goes. It's gotta be something about my environment.
Schmelter
This was accepted -- does that mean the problem went away when you reinstalled XCode? (not looking forward to that one, so would love some kind of confirm before I do)
Kalle
A: 

The function in question:

/***********************************************************************
* getName
* fixme
* Locking: runtimeLock must be held by the caller
**********************************************************************/
static const char *
getName(struct class_t *cls)
{
    // fixme hack rwlock_assert_writing(&runtimeLock);
    assert(cls);

    if (isRealized(cls)) {
        return cls->data->ro->name;
    } else {
        return ((const struct class_ro_t *)cls->data)->name;
    }
}

…if somebody can make something out of it :)

zoul
Yeah, it seems that the *cls being passed in is NULL. Which is... weird. To say the least.
Schmelter