Want to invert BOOL value in iOS sdk
boolean, ios
Solution
You can't cast `id` to `BOOL`. Assuming it is stored correctly, the way you get it out of a dictionary is through the number wrapper `NSNumber`.
NSNumber *boolWrapper = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"ABC"];
return ![boolWrapper boolValue];
This will return 0 for 1 and 1 for 0.
If you simply cast it like you are doing, it will always be true unless the object doesn't exist (i.e. it is `nil`).
Problem
I am getting id values from plist in iOS sdk, if i am getting value 0 then I have to show it as 1 and vice versa. Here is my code for the same ``` +(BOOL) removeButton { id obj = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"ABC"]; if (obj != Nil) { return (BOOL)obj; } return YES; } ``` But the problem is that as the value for id is 0 then it will return No and vice versa. But I want to put my condition in opposite matter such as suppose the value for id is 0 then I have to show return YES and vice versa.