Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6871553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:49:12+00:00 2026-05-27T03:49:12+00:00

Recently we came across a situation where we wanted to see the debug info

  • 0

Recently we came across a situation where we wanted to see the debug info from the app which a user has on his device. So, what I am looking for is a way to find the log on the device, paste it as inline text on a mail and allow the user to send it..

Any ideas? Here are the questions again..
1)Find a debug log on the device
2)open the file and attach the contents of the file as inline text in to the mail.
3)Allow the user to email it the next time app launches..

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:49:13+00:00Added an answer on May 27, 2026 at 3:49 am

    Thanks for all the inputs guys.. I clubbed your solutions into one that would solve my problem.. Here is what I made it to be.. Surely I did not compile the code, it is a half baked code.. but I will iron it soon once as I implement it in my code..

    NSLog into file How to NSLog into a file LOG2FILE

    #if TARGET_IPHONE_SIMULATOR == 0    
        NSArray *paths =  
        NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);        
        NSString *documentsDirectory = [paths objectAtIndex:0];    
        NSString *logPath = [documentsDirectory stringByAppendingPathComponent:@"console.log"];    
        freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
    #endif
    

    Catch the Crash and Log them too into a File

    First, create a function that will handle the error and output it to the console (as well as whatever else you want to do with it):

    void uncaughtExceptionHandler(NSException *exception) {    
        NSLog(@"CRASH: %@", exception);      
        NSLog(@"Stack Trace: %@", [exception callStackSymbols]);    
        // Internal error reporting
    }
    

    Next, add the exception handler to your app delegate:

    -(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:  
    (NSDictionary*)launchOptions
    {   
        NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);    // Normal launch stuff
    }
    

    Set a variable in the info.plist called Crashed and then read/write it this way

    - (void)readPlist
     {
          NSString *localizedPath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"plist"];        
          NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:localizedPath];
    
        NSString *crashed;
        crashed = [plistDict objectForKey:@"Crashed"];
    }
    
    
    - (void)writeToPlist
    {
        NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
    
        [plistDict setValue:@"YES" forKey:@"Crashed"];
        [plistDict writeToFile:filePath atomically: YES];
    }
    

    Once the app launches read the info.plist and prompt the user to submit the crash logs..

    {
        MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
        mailComposer.mailComposeDelegate = self;[mailComposer setSubject:@"Crash Log"];
        // Set up recipients
        NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"]; 
        [mailComposer setToRecipients:toRecipients];
        // Attach the Crash Log..
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *logPath = [documentsDirectory stringByAppendingPathComponent:@"console.log"];
        NSData *myData = [NSData dataWithContentsOfFile:logPath];
        [mailComposer addAttachmentData:myData mimeType:@"Text/XML" fileName:@"Console.log"];
        // Fill out the email body text
        NSString *emailBody = @"Crash Log";
        [mailComposer setMessageBody:emailBody isHTML:NO];
        [self presentModalViewController:mailComposer animated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently came across the situation where I wanted a set of classes to
Recently, I came across a volatile flag technique, which I may avoid from using
I recently came across DUI (Diggs user interface) which implements jquery and gives you
I recently came across a situation where I had to use XPath as part
Recently I came across a situation where set theory and set math fit what
I recently came across the pandas library for python, which according to this benchmark
I recently came across this: SELECT 'Y', ltrim(rtrim(upper(Newly_Eligible))) FROM Table WHERE Id = 1
I recently came across this website http://www.smartusa.com/ This has an awesome scrolling effect and
I recently came across this blog post which basically says that we should not
I recently came across the Ruby EOB / -EOB construct within this context (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.