I am trying to set an NSNumber as a float value that has been loaded using NSUserDefaults but i'm getting an error. I can't understand why...?
Here's my code:
Code:
[settingsData.sensitivitySettingValue floatValue] = [[NSUserDefaults standardUserDefaults] floatForKey:@"sensitivityKey"];
It works if I use a float on its own (i.e float myFloat = [[NSUserDefaults standardUserDefaults] floatForKey:@"sensitivityKey"]
, but I want the value available across all view controllers so I have defined it in a model class as an NSNumber.
So, please would anyone be able to advise me on why that statement wont work?