Similar to how NSLog takes variable argument list, I want to create my own method.
I have my method declared like this but when I try to access the 'args' variable, I get an EXEC_BAD_ACCESS. What is that I'm not doing correctly here?
- (void)info:(NSString *)formatString, ...
{
va_list args;
va_start(args, formatString);
NSLog(@"formatString value: %@", formatString);
// The following line causes the EXEC_BAD_ACCESS
NSLog(@"args value: %@", args);
// This is what I'm trying to do:
NSLog(formatString, args);
va_end(args);
}
I was following the 'va_list in Cocoa' section from this blog: http://cocoawithlove.com/2009/05/variable-argument-lists-in-cocoa.html