Hi i have a problem i want to test if my string is not empty and not equals to string1 i wann do something but it do not works.
my code:
NSUserDefaults *namePrefs = [NSUserDefaults standardUserDefaults];
NSString *savedName = [namePrefs stringForKey:@"myKey"];
if ((savedName != nil)&&([savedName isEqualToString:@"string1"])){ //
[self myFunction];
}
it do not enters when the savedName is nil it is ok
it enters when the value of it is not nil and not string1 it is also ok
but it enters when savedName is string1, WHY?
thanks for any help bye
yes it will enter if savedname =string1
then it will enter in the block because it is satifing ur conditon.
savedname !=nil true
savedname ==string1 true
then why should not it enter in the block. it will enter bcoz it satisfying ur condition.