objective c - [NSNull isEqualToString:]: unrecognized selector sent to instance -
try compare field returned web-service , contains either string true or false (yes, it's string , not boolean), try compare string :
if ([withoptions isequaltostring:@"true"]) { annotation.stationlavage=@"with"; }else { annotation.stationlavage=@"without"; } so when withoptions string contains "true" string, ok, , when contains "false" string got exception in log :
terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[nsnull isequaltostring:]: unrecognized selector sent instance 0x2984d68' i pretty sure in cases, withoptions contains string value (either "true" or "false") , never contains null.
i pretty sure in cases, withoptions contains string value (either "true" or "false") , never contains null.
clearly, assumption wrong. :)
on line before if() statement, add nslog(@"%@ - %@", withoptions, [withoptions class]);
not nsnull , null not same thing; nsnull class singleton instance represents "no value" in containers (and other things) don't accept nil values.
when crash occurs, withoptions referring instance of nsnull.
Comments
Post a Comment