Skip to main content

how to pass NSUserDefaults integer to a UInt32 object



I am wondering if it is possible to pass an integer value I am creating in my NSUserDefaults into a UInt32 object?





So far I am creating the NSUserDefaults as below.







NSString * yourKey = @"RequestNumber";

NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];

[defaults setInteger:[defaults integerForKey:yourKey] + 1 forKey:yourKey];







and then I am trying to pass the user defaults value into my object as below.. However I am fairly positive I am completely wrong... which is why im here :) any help would be appreciated.







UInt32 *requestNumber = [[NSUserDefaults standardUserDefaults] integerForKey:yourKey];




Comments

  1. A UInt32 is not an object but a scalar type.

    UInt32 requestNumber = [[NSUserDefaults standardUserDefaults] integerForKey:yourKey];

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?