Objective C: Function help-Collection of common programming errors
Greetings,
I have the following function:
-(NSString*) nudgePhoneNumber:(NSString*)num{
NSString *nudged=@"";
[nudged stringByReplacingOccurrencesOfString:@"+" withString:@""];
[nudged stringByReplacingOccurrencesOfString:@"\\s" withString:@""];
[nudged stringByReplacingOccurrencesOfString:@"-" withString:@""];
[nudged stringByReplacingOccurrencesOfString:@"." withString:@""];
[nudged stringByReplacingOccurrencesOfString:@"/" withString:@""];
//NSLog(nudged);
return nudged;
}
And I’m calling it as follows:
-(IBAction) phoneNumberUp:(id)sender{
NSString *mob=phoneNumber.text;
NSString *result=@"";
[result nudgePhoneNumber:mob];
...
}
But I keep getting an exception: “-[NSCFException nudgePhoneNumber:]: unrecognized selector sent to instance” and “Terminating app due to uncaught exception ‘NSInvalidArgumentException'”
I’m quite new to Objective-C and think I just need someone to have a quick look-over.
Many thanks in advance,