Search code examples
iphoneiosnsnumberuint32

Error passing NSNumber to UInt32


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


Solution

  • You print a NSString not a UInt.

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