I know that the title of this question is a bit confusing, but here anyway:
I create an NSString after the statement if, but it just doesn’t want to save outside the statement. My condition is as follows:
if ([[password stringValue] isEqualToString:@""]) {
NSString *pwd = [[NSString alloc]initWithString:@"password"];
}
else {
NSString *pwd = [[NSString alloc]initWithFormat:@"%@", [password stringValue]];
}
... and I call pwdlater in the script as follows:
NSArray *arguments;
arguments = [NSArray arrayWithObjects: ip, pwd, nil];
[task setArguments: arguments];
But when I do this, the first fragment returns a warning Unused variable 'pwd', and the last call ends in an error 'pwd' undeclared.
What am I doing wrong here? Thanks in advance.;)
source
share