I am making an app for the iPhone using Xcode and I think that Xcode is messing me up…
I have in the ViewController.h:
@property (weak, nonatomic) IBOutlet UITextField *passwordField;
@property (weak, nonatomic) IBOutlet UILabel *passwordResult;
- (IBAction)go:(id)sender;
and in the ViewController.m:
- (void)viewDidLoad {
A = @"A";
}
- (IBAction)go:(id)sender {
password = [NSString stringWithFormat:@"%@", _passwordField.text];
if (password == A) {
_passwordResult.text = [NSString stringWithFormat:@"%@", A];
}
}
This should print the capital letter ‘A’ to my label if the input is a capital ‘A’, right?
If not, How would I do this?
NOTE: I do not want to just copy the inputted phrase and print that, I want to make a password cracker application just to see if it works…
Instead of:
use
Otherwise, you’re only comparing pointers, not the contents of the strings themselves.