I\'m trying to pass an NSString by reference but it doesn\'t work.
This is the function:
+(void)fileName:(NSString *) file
{
file =
I believe you're looking for:
+ (void)fileName:(NSString **)file
{
*file = @"folder_b";
}
What's really done here is we're working with a pointer to a pointer to an object. Check C (yup, just plain C) guides for "pointer dereference" for further info.
(...But as has been pointed out repeatedly, in this particular example, there's no reason to pass by reference at all: just return a value.)