When I us开发者_如何学Pythone ==
to compare the strings it works on all but some strings that have a space added... (added with [NSString stringWithFormat:@"%@ %@",self.title,collectionName])
But when I compare with isEqualToString
, it returns True/YES every time. The comparison in the image goes into the condition and hits the return... Should be impossible for this to hit line 640, but it does.
Can anyone explain this?
There is a ";" after the ")" on line 637 that why it always went into the condition... damn I suck... seems like that would throw an error somehow
If you use the LLVM compiler
in Debug project setting, (not quite stable enough for release yet I think), you'll get warnings about issues like the one you had.
In your case it would issue a warning than an "if" statement had an empty body.
Used in conjunction with turning on the static analyzer for every build, you can catch a ton of problems early, especially the stupid ones that are hard to debug because they are so stupid they are easy to overlook (and here I am not criticizing you, as I have made the same mistake countless times!)
精彩评论