Question

I am trying to pass a NSNumber into a UInt32 variable, it seems to work but when I go to log the UInt32's value I get stuck.

this is what my code looks like.

if ([methodName isEqualToString:@"Manu"]) {
        cacheNumber = [cacheValue objectForKey:@"Manus"];

        NSLog(@"%@", cacheNumber); // This produces the correct number
    }

    UInt32 CACHE_VALUE = [cacheNumber intValue];
    NSLog(@"%@", CACHE_VALUE); // This is where my thread gets stuck

This is the message that it produces when I try to step through the second NSLog (as I have breakpoints on both logs to check their output).

Single stepping until exit from function objc_msgSend, which has no line number information.

any help would be greatly appreciated

Was it helpful?

Solution

You print a NSString not a UInt.

    NSLog(@"%lu", CACHE_VALUE); // This is where my thread gets stuck

OTHER TIPS

As you're logging an integer and not an object, ie. an NSString, you should use the %d (decimal) placeholder instead of %@ (object).

NSLog(@"Value: %d", CACHE_VALUE);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top