Skip to content

Instantly share code, notes, and snippets.

@MattFoley
Created May 18, 2013 21:40
Show Gist options
  • Save MattFoley/5605869 to your computer and use it in GitHub Desktop.
Save MattFoley/5605869 to your computer and use it in GitHub Desktop.
Write Console to File iOS
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fileName =[NSString stringWithFormat:@"%@.log",[NSDate date]];
NSString *logFilePath = [documentsDirectory stringByAppendingPathComponent:fileName];
freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment