NSInteger
isn't an object -- it's simply typecast to int
on 32-bit or long
on 64-bit. Since NSDictionary
can only store objects, you need to wrap the integer into an object before you can store it. Try this:
NSInteger temp = 20;
[userSettingsFromFile setObject:[NSNumber numberWithInteger:temp]
forKey:@"aTemp"];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…