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

  • Home
  • SEARCH
  • 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 8496329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:49:20+00:00 2026-06-10T23:49:20+00:00

I am trying to creating a file on my MacOS FS from my IPhone

  • 0

I am trying to creating a file on my MacOS FS from my IPhone app by means of this code

 [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) ];
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,   NSUserDomainMask, YES);
   NSString *path = [paths objectAtIndex:0];
   path = [path stringByAppendingPathComponent: @"log.txt"];
   NSFileHandle *output = [NSFileHandle fileHandleForWritingAtPath:path];
  if(output == nil) {
    [[NSFileManager defaultManager] createFileAtPath:path contents:nil attributes:nil];
    output = [NSFileHandle fileHandleForWritingAtPath:path];
   } else {
    [output seekToEndOfFile];
  }

I guess the code is OK as it works when executed by the Simulator. However I can’t actually see where the file is created when executed from the IPhone. If I print the path I get

/var/mobile/Applications/XXX-XXXX-XXX-XXX/Documents/log.txt

  • 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-06-10T23:49:22+00:00Added an answer on June 10, 2026 at 11:49 pm

    On the simulator, you should find them under: /Users/loginname/Library/Application Support/iPhone Simulator/5.1/Applications/594931F3-B9EF-4B2C-833D-76C2DCC61C6B/Documents. You can go to this location from Finder by choosing the Go menu item, holding down the Option key, then choosing Library.

    NOTE: Fill in your own loginname and device ID in the path above.

    If you are on the device, you can copy the file over to your Mac using XCode, using the organizer (choose Window | Organizer). Highlight the App (after it has been executed, of course) and there is an option to copy the file over. You don’t have direct access to the device file system.

    You can also use NSLog() which just sends the debug info to the output window in XCode.

    EDIT: Added detail on how to show Library folder.

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

Sidebar

Related Questions

I am trying to execute the code inside of a .h File by creating
I'm trying to store data from a xml-file in a associative Array. Creating the
I'm creating my first gradle plugin. I'm trying to copy a file from the
i need some help with creating file Im trying in the last hours to
I'm creating an epub file and am trying to understand an example css for
I am trying to parse a rather long log file and creating a better
I am trying to read from a file and write the output to a
I am trying out creating Spring MVC app on SpringToolSuite (STS) IDE. I do:
I am trying to copy an SPListItem (with file) from one site collection to
I have problem when creating a file in encoding 'utf-8' and reading it 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.