Your code doesn't look right. How about this:
(Edited to use fast enumeration (for...in loop syntax)
//Loop through the array of switches.
for (UISwitch *mySwitch in self.switchCollection)
{
//Get the tag for this switch
int tag = mySwitch.tag;
//Try to fetch a string from the dictionary using the tag as a key
NSNumber *key = @(tag);
NSString *dictionaryValue = self.myDictionary[key];
//If there is an entry in the dictionary for this tag, set the switch value.
if (dictionaryValue != nil)
{
BOOL enabledValue = [dictionaryValue boolValue];
mySwitch.enabled = enabledValue;
}
}
That's assuming I understand what you're trying to do...