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 6151201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:44:16+00:00 2026-05-23T19:44:16+00:00

Simply put I would like to print to the console when my device is

  • 0

Simply put I would like to print to the console when my device is attached and print to the device when it is not attached. I never use the simulator, but would like to have a sort of guard similar to the one below. Except rather then detecting whether or not I’m using the simulator I would like to automatically detect if the device is attached or not.

Anyway we could make this happen?

Thanks!

#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
  • 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-23T19:44:17+00:00Added an answer on May 23, 2026 at 7:44 pm

    Print to console vs Print to device means?
    When you use the normal NSLog, it shows up on Console when device is connected and shows up on device log (which you can extract from Xcode organizer) when not connected.

    Can you be a bit more specific on what you are trying to do?

    Update

    enter image description here

    This is where you see the log.

    On organizer, you have something called “Devices”. Expand that, and select “Console”. The console will be pretty messy since it contains logs of all apps and system built-in logs as well. You can filter them by your app name though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a console application in which I would like to put a non-deterministic
Ok, this is possibly borderline-subjective, but I wonder where one would put a simple
Simply put, I have a table with, among other things, a column for timestamps.
Simply put, if you had to use a IoC/DI container, thats easy to deploy
Simply put I want what http://www.reddit.com/ and http://news.ycombinator.com/ have to the left of every
I would like to use argparse to take some (3) integer arguments, and use
I would like to use Perl to take a previously generated SPSS syntax file
Put simply: I want the following code to print sub: Element e = new
I have a simple jquery cycle gallery populated by PHP. I would like to
Not quite sure how to phrase this, but will do my best. I have

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.