Wie man Richtig einen integer-Wert in NSDictionary?

Den folgenden code-snippet:

NSLog(@"userInfo: The timer is %d", timerCounter);

NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:timerCounter] forKey:@"timerCounter"];

NSUInteger c = (NSUInteger)[dict objectForKey:@"timerCounter"];
NSLog(@"userInfo: Timer started on %d", c);

erzeugt eine Ausgabe, die entlang der Linien von:

2009-10-22 00:36:55.927 TimerHacking[2457:20b] userInfo: The timer is 1
2009-10-22 00:36:55.928 TimerHacking[2457:20b] userInfo: Timer started on 5295968

(FWIW, timerCounter ist ein NSUInteger.)

Ich bin sicher, ich bin etwas fehlt ziemlich offensichtlich, eben nur nicht sicher, was es ist.

InformationsquelleAutor der Frage Bill | 2009-10-22

Schreibe einen Kommentar