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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:01:05+00:00 2026-06-17T00:01:05+00:00

I am having an issue reading from a custom plist. I have found the

  • 0

I am having an issue reading from a custom plist. I have found the Apple documentation, and many posts on here and elsewhere, but I cannot understand what I am doing wrong.

My plist is a dictionary with two strings (urls).

Here is my code that is just like Apple’s and other sites:

- (void)accessPlistForURLDictionary
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsPath = [paths objectAtIndex:0];
    NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"server_urls.plist"];

    if (![[NSFileManager defaultManager] fileExistsAtPath:plistPath])
    {
        // if not in documents, get property list from main bundle
        plistPath = [[NSBundle mainBundle] pathForResource:@"server_urls" ofType:@"plist"];
        NSLog(@"bundle");
    }

    NSData *xml = [[NSFileManager defaultManager] contentsAtPath:plistPath];
    NSString *error = nil;
    NSPropertyListFormat format;
    // convert static property liost into dictionary object
    NSDictionary *plistDictionary = (NSDictionary *)[NSPropertyListSerialization propertyListFromData:xml mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&error];
    if (!plistDictionary)
    {
        NSLog(@"Error reading plist: %@, format: %d", error, format);
    }

    serverURL = [[plistDictionary objectForKey:@"Root"] objectForKey:@"get_firstview"];
    NSLog(@"serverURL in accessPlist is: %@", serverURL);
}

Here is the log…. I don’t get why serverURL (a string variable that is synthesized) is ‘null’

2013-01-07 12:47:06.742 ME[2305:c07] bundle
2013-01-07 12:47:06.744 ME[2305:c07] serverURL in accessPlist is: (null)
2013-01-07 12:47:06.744 ME[2305:c07] serverURL is: (null)

The last check is done right before I use serverURL in viewDidLoad

I have the plist added in Build Settings (I think). It must be an issue with my code, but I can’t find what.

  • 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-17T00:01:06+00:00Added an answer on June 17, 2026 at 12:01 am

    There is easier way to load plist into NSDictionary

    NSMutableDictionary *plistDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile: plistPath];
    

    Try that.

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

Sidebar

Related Questions

I'm having an issue reading from a java input stream. I have a buffer
I am having following issue with reading binary file in C. I have read
Hi guys I am having issue I have this query: SELECT * FROM useraccount
Having an interesting issue. I'm reading from an excel file on a server via
i am having an issue, where java is reading an array list from a
I'm having a peculiar issue. I'm reading the HTML from a div contenteditable, and
I am having a problem reading back from windows azure table storage: Here is
So I'm having an issue reading a text file into my program. Here is
I have a weird issue with regards to getline while reading from file. Below
Im having an issue reading in lines from a file. Basically my code is

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.