I defined an objective-C method which expect an arbitrary set of parameters
- (void)logString:(NSString *)format, ... {
__block va_list argList;
va_start (argList, format);
NSString *formattedString = [[NSString alloc] initWithFormat:format arguments:argList];
va_end(argList);
NSLog(@"[ProCheck] %@", formattedString);
}
If I call directly this method everything works fine. Now I need to call this method from a method which take the same set of parameters:
- (void)doSomethingAndLogString:(NSString *)format, ... {
<my code doing something>
__block va_list argList;
va_start (argList, format);
[self logString:format, argsList];
va_end(argList);
}
But it result in a runtime exception EXC_BAD_ACCESS .
I think I might be wrong with object retain cycle, any clue?