I made a method like this:
-(void) doSomething:(NSString *)str
{
}
I call it like this
doSomething(foo);
It doesn't work.
I made a method like this:
-(void) doSomething:(NSString *)str
{
}
I call it like this
doSomething(foo);
It doesn't work.
That is because doSomething
is a method of an Objective-C class. The C syntax for function calls doesn't apply here and you need an instance to call it on, e.g.:
[instance doSomething:foo];
I strongly recommend to read through Apples The Objective-C programming language.
The way that you call methods in objective c is like the following
[class method:parameter];
In your case, to call doSomething, you would do this:
[self doSomething:@"foo"];