Is it correct to write objective-c method like this
-methodA: (NSString *)str // without return type
{
return @"test";
}
Above method is working fine for me.
Is -methodA: (NSString *)str same as -(id)methodA: (NSString *)str?
I am using Mac 10.5 os x sdk.
To answer your question, from “The Objective-C 2.0 Programming Language”:
So
- methodA:(NSString *)stris valid and the same as- (id)methodA:(NSString *)str.However having said that it is certainly unusual coding practice and not to be encouraged – type the extra four characters!