younotesunreadstarredadd url

NSCoriolisBlog » Blog Archive » Redirect NSLog to a file on the iPhone

http://blog.coriolis.ch/2009/01/09/redirect-nslog-to-a-file-on-the-iphone/

july 2010debug tips xcodeopen in karakeep

by Stephan Burlot ‧ DZ-015 ‧ published 2009.01.09 ‧ saved copy from 2026.03.03

Karakeep has no AI summary for this page yet. summarize now

page description:

If you need to debug your app when disconnected from your Mac (and from the console), redirect all your NSLog calls to a file so you can later read it. The method below will create a file name « console.log » in the Documents folder of your application so you can later read it. Just call this method in your program: - (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); } The log will never be erased, so use with caution. Once you have tested your app in the filed, reconnect your phone to your Mac and in Xcode, open the Organizer. In the Summary panel, you have the list of all the apps on your phone. Expand the one you’re debugging, and you’ll a package named « Application Data ». Click the arrow on the right of its name and ... Lire la suite…
screenshot of the page

« back to bookmarks