Yes, string literals like @"Hello world" are never released, and they point to the same memory, which means that the pointer comparison is true.
NSString *str1 = @"Hello world"; NSString *str2 = @"Hello world"; if (str1 == str2) // Is true.
It also means that a weak string pointer will not change to nil (which happens for regular objects), since a string literal is never freed.
__weak NSString *str = @"Hello world"; if (str == nil)
source share