I recently had some code that worked great on a simulator and twisted the device. What for? βIt is very simple, but I cannot explain this explanation.β
I did a little testing by creating a new application based on the view, added a shortcut and a socket for the tag, and wrote this code in viewDidLoad:
BOOL b; if (b) { label.text = @"Value = YES"; } else { label.text = @"Value = NO"; }
Interestingly, here are the results:
iOS Simulator (4.2): Value = NO
iOS Simulator (4.3): Value = NO
iPod Touch 2G (4.2.1) Value = YES
iPhone 3G (4.2.1)) Value = YES
What does that say? - Well, for me it looks like devices, the default logical value is YES, and on the simulator the default value is NO.
Can anyone clarify if this is so? Also, if someone can explain this behavior, I would be very interested.
I am not interested in solving the problem, so it can be solved by setting the desired default (in my case NO
) manually.
Thanks.
source share