I\'m trying to pass the boolean value of a UISwitch to another class using NSUserDefaults. For some reason, in the class that contains the switches
UISwitch
NSUserDefaults
The problem is that you need to put your code inside a method. All you need is to move it to viewDidLoad() or any other method.