Quite a stupid problem really, but I am very new to the world of programming an have run into this problem where I am trying to pass a float variable from one view controller to another. I have found this great way in which to do it with strings, but I cannot get it to work with floats. Any suggestions?
Your help is much appreciated!
//Passing the data in first view controller
float savedAudioLevel = _slAudioVolume.value;
NSUserDefaults *defaultsAudio = [NSUserDefaults standardUserDefaults];
[defaultsAudio setFloat:savedAudioLevel forKey:@"currentAudioLevel"];
[defaultsAudio synchronize];
//Receiving the data in second
NSUserDefaults *defaultsAudio = [NSUserDefaults standardUserDefaults];
float loadfloatAudio = [defaultsAudio valueForKey:@"currentAudioLevel"]; //Getting an error here
_currentAudioVolume = loadfloatAudio;