Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
I have a secure text field for a password, and it works fine because I haven't done anything to it. But when I try using the following line of code,
[getPassword setStringValue:password];
The rest of the code in the method doesn't get called. Additionally, getPassword still doesn't equal the password. How do I retrieve the password? I've looked at the class documents and securetextfield doesn't seem to have any protection, it doesn't add anything to a regular textfield except that you can't see the typing. Help would be appreciated.
Thanks, Nate
 
There was another recent thread with NSSecureTextField not working as expected, but from what I can, it is working fine (I made a sample project and tested it). I'm not sure what else to say, just make sure you're using the standard setStringValue: and stringValue methods on the text field, which it looks like you are doing.
 
I tried changing it to
Code:
[thePassword setValue:[password stringValue]];
But it still didn't work. Oh yeah... thePassword is just an NSString, properly alloc'd and init'd. Here's what the console says each time I get to this line, even when I make changes like the above one.
Code:
[Session started at 2008-10-01 15:16:28 -0400.]
2008-10-01 15:16:35.506 Finder[5232:10b] *** -[NSCFString setValue:]: unrecognized selector sent to instance 0xa0721328
2008-10-01 15:16:35.507 Finder[5232:10b] *** -[NSCFString setValue:]: unrecognized selector sent to instance 0xa0721328

The Debugger has exited with status 0.
 
NSString doesn't have a setValue: method. Unless you're using an NSMutableString you can't change a string's value. Reassign it like so:
Code:
thePassword = [password stringValue];
 
thanks... problem solved. I always forget about mutable/immutable classes <_<
Nate
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.