I don’t get it. i am a newbie to objective c and i just don’t get what i am doing wrong here. I get the following error when building my code: “Class method ‘+ValidateUserInfo:strPwd:’ not found “. I’m sure it’s something simple for some of you out there and i just see my mistake. What is the correct way to call my method ValidateUserInfo?
@implementation LoginViewController
-(IBAction)CheckInfo:(id)sender
{
NSString *strUserName = [[txtUsername text] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSString *strPass = [[txtPass text] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
[LoginViewController ValidateUserInfo:strUserName myPass:strPass];
}
+(void)ValidateUserInfo:(NSString *)name myPass:(NSString*)strPwd
{
NSLog(@"VALIDATE user: %@",name);
NSLog(@"VALIDATE pwd: %@",strPwd);
}
@end
That looks fine, is it a compiler warning? if so it will be due to the fact that you don’t declare the method in your header file (.h)…
Add the following before the
@endin the header…