I know the title of this question is a bit confusing, but here it goes anyway:
I\'m creating an NSString after an if
statement but it just doesn\'t seem
It's not a problem of retaining, but one of scope of your declarations: a declaration within braces has a lexical scope that terminates at the closing brace -- that declaration's just not visible outside of the block! So just move your declaration before the block and have only the initialization within the block, i.e.:
NSString *pwd;
if ([[password stringValue] isEqualToString:@""]) {
pwd = [[NSString alloc]initWithString:@"password"];
}
else {
pwd = [[NSString alloc]initWithFormat:@"%@", [password stringValue]];
}