Skip to content

Instantly share code, notes, and snippets.

@paiv
Created March 1, 2013 15:14
Show Gist options
  • Save paiv/5065281 to your computer and use it in GitHub Desktop.
Save paiv/5065281 to your computer and use it in GitHub Desktop.
NSArray to va_list arguments and string format
- (NSString *)stringWithFormat:(NSString *)format args:(NSArray *)args
{
NSMutableData *data = [NSMutableData dataWithLength:(sizeof(id) * args.count)];
[args getObjects:(__unsafe_unretained id *)data.mutableBytes range:NSMakeRange(0, args.count)];
NSString *so = [[NSString alloc] initWithFormat:format arguments:data.mutableBytes];
return so;
}
@yousefhamza
Copy link

Xcode 8: EXC_BAD_ACCESS

@pgawlowski
Copy link

Same here. Is it possible that NSTaggedPointerString * has something to do here?

@teras
Copy link

teras commented Sep 27, 2018

Any solution to this? I ave the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment