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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:46:10+00:00 2026-05-20T15:46:10+00:00

I am trying to test out writing a dictionary to a plist. The following

  • 0

I am trying to test out writing a dictionary to a plist.
The following code does not report any errors, but I cannot find any trace of the file that I supposed wrote.
Here is the code snippet:

 NSDictionary *myDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
 @"First letter of the alphabet", @"A",
 @"Second letter of the alphabet", @"B",
 @"Third letter of the alphabet", @"C",
 nil
 ];

I can see the dictionary contents displayed properly with either method calls:

NSLog(@"Here is my partial dictionary %@", myDictionary); 

for (NSString *key in myDictionary)
    NSLog(@"here it is again %@ %@", key, [myDictionary objectForKey:key]);

The following code displays the “succeeded” message when the program is run repeatedly

if ([myDictionary writeToFile: @"myDictionary" atomically:YES ] == NO)
    NSLog(@"write to file failed");
    else
    NSLog(@"write to file succeeded");

even when changing the atomically: argument to NO to not write a temporary file.
However, when I search my current directory, or even my entire Mac, I cannot find any file called “myDictionary.plist” or any file with the string “myDictionary”.

Isn’t the path variable “@myDictionary” supposed to represent the file at the current directory, i.e. where the class executable resides?

  • 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-20T15:46:11+00:00Added an answer on May 20, 2026 at 3:46 pm

    Your code tells the system to write the dictionary on a file, but on what file, what is the path to the file’s location? Alekkhya’s code does that, it defines a particular directory in the application sandbox(the Documents directory), gets the path to it and writes the file there.

    I suggest you read this.

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

Sidebar

Related Questions

I'm trying to test out the GettingStarted sample site with our LE instance but
i'm trying to figure out the code for the jquery selector test found at
I'm trying to figure out the best way of writing a unit test for
I have been trying to figure out the best practices to write test-friendly code,
I'm just writing some code to test the D3DXVec3Project function, trying to get it
I'm writing some code, when I'm trying to test my code till now, I
I am trying to test out some Dapper stuff using LinqPad. Dapper needs a
I am currently having unnecessary trouble trying to test out RubyMine. My biggest problem
When trying to start my JUnit-Test out of Eclipse, I get a ClassNotFoundException. When
I'm trying to script out unit test for Android on a Mac. I'm able

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.