I just got back into Obj-C, I guess I can never say I was ever in.
Anyhow, here is my .m file:
And my .h file:
I was hoping somebody could look over it for any tidying up that you can see. I think it's good so far.
My 3 problems though:
1. Understanding Methods, I don't know how to call them. I try: [test url"~/test.xml"], but it says Test isn't defined, how would I define it for something like this?
2. How would it be best for me to authenticate some users? I have a database set up (on Apache/PHP/MySQL), I was assuming I would have to make a mini-api to call back and forth and read the XML. Is that the only way, or what?
3. usernameString == "Garrett", that doesn't work, regardless if I ever put Garrett in the username field.
Thanks for all the help in advance!
Anyhow, here is my .m file:
Code:
#import "GBBkwld.h"
@implementation GBBkwld
- (IBAction)login:(id)sender {
NSString *usernameString = [usernameValue stringValue];
NSString *passwordString = [passwordValue stringValue];
if(usernameString == "Garrett" && passwordString == "password") {
//[spinner startAnimation:self];
[status setStringValue:@"Logged In!"];
} else {
//[spinner stopAnimation:self];
//[usernameValue setEnabled:YES];
//[passwordValue setEnabled:YES];
[status setStringValue:@"Wrong Info."];
}
NSLog(@"Username: %@ and Password: %@", usernameString, passwordString);
}
@end
Code:
#import <Cocoa/Cocoa.h>
@interface GBBkwld : NSObject {
IBOutlet id spinner;
IBOutlet NSSecureTextField *passwordValue;
IBOutlet NSTextField *usernameValue;
IBOutlet NSTextField *status;
}
- (IBAction)login:(id)sender;
@end
I was hoping somebody could look over it for any tidying up that you can see. I think it's good so far.
My 3 problems though:
1. Understanding Methods, I don't know how to call them. I try: [test url"~/test.xml"], but it says Test isn't defined, how would I define it for something like this?
Code:
- (void) loginTest:(NSString*)url {
NSLog(@"%@", url);
}
3. usernameString == "Garrett", that doesn't work, regardless if I ever put Garrett in the username field.
Thanks for all the help in advance!