Created
November 18, 2012 08:33
-
-
Save nolili/4104270 to your computer and use it in GitHub Desktop.
NSLogの情報をサンドボックスにテキストファイルとして書き出す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) redirectConsoleLogToDocumentFolder | |
{ | |
//ログを出力する | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *documentsDirectory = [paths objectAtIndex:0]; | |
NSString *logPath = [documentsDirectory stringByAppendingPathComponent:@"console.log"]; | |
freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr); | |
NSLog(@"Start Logging"); | |
//バージョン情報をログに出力 | |
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; | |
NSLog(@"Bundle Version : %@",version); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment