IF clause is not validating NSString function return?

后端 未结 2 835
南笙
南笙 2020-12-12 04:50

I have the function below that validates the return of another function (function searchPlaces that returns NSString). When I run it, it seems that the if clause is not bein

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 05:50

    You should use isEqualToString: method of NSString to check for equality of strings. == operator does a pointer comparison and sometimes it will return NO although the contents of the strings are the same.

提交回复
热议问题