Objective-C Comparison of NSDictionary Values

I am returning a string from T or F from a pair of NSDictionary key values. I am trying to figure out if it is T or F, but it never works as I expected. I am sure that there is a very simple solution to this problem.

if ([game objectForKey:@"complete"] == @"T") never evaluates to true.
+3
source share
1 answer

Change this to:

if ([[game objectForKey:@"complete"] isEqualToString: @"T"]) 

What you did was compare string pointers, not their contents.

+13
source

Source: https://habr.com/ru/post/1721002/


All Articles