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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:35:26+00:00 2026-06-03T02:35:26+00:00

I have set up a object class that I am using to create my

  • 0

I have set up a object class that I am using to create my pList however I am having some issues with it. I am using the singleton design pattern on the class so I only have to deal with one instance of it at any one time…

for some weird reason it has stopped working properly and for the life of me I cannot figure out why, I am woundering if it has something to do with it being in a singleton design pattern..

#pragma mark Singleton Methods
+ (id)sharedManager {
    @synchronized(self) {
        if (sharedMyManager == nil)
            sharedMyManager = [[self alloc] init];
    }
    return sharedMyManager;
}
- (id)init {
    if (self = [super init]) {

        // get paths from root direcory (where we will store and fine our plist in the future)
        NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
        // get documents path
        NSString *documentsPath = [paths objectAtIndex:0];
        // get the path to our plist file
        NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"EngineProperties.plist"];

        NSLog(@"pList path = %@", plistPath);

        // check to see if .plist exists in documents
        if (![[NSFileManager defaultManager] fileExistsAtPath:plistPath])
        {
            // if not in documents, get property list from main bundle
            plistPath = [[NSBundle mainBundle] pathForResource:@"EngineProperties" ofType:@"plist"];

        }

        // read property list into memory as an NSData object
        NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath];
        NSString *errorDesc = nil;
        NSPropertyListFormat format;
        // convert static plist into dictionary object (this is where any saved values get put into 
        savedEnginePropertiesDict = (NSMutableDictionary *)[NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc];

        //Load all current values of the property list thats been put into savedEnginePropertiesDict into their variables
            if (savedEnginePropertiesDict && [savedEnginePropertiesDict count]){
                // assign values
                self.sig = [savedEnginePropertiesDict objectForKey:@"Signature"];
                self.ver = [savedEnginePropertiesDict objectForKey:@"Version"];
                self.num = [savedEnginePropertiesDict objectForKey:@"Number"];
                self.dataV = [savedEnginePropertiesDict objectForKey:@"Data"];
                self.cache = [savedEnginePropertiesDict objectForKey:@"Cache"];

        }
    }
    return self;
}

This should be creating the directory where the plist should reside, then if its there reading it, else creating it.. but its not doing any of that.. and I am at a complete loss as to figuring out why its not working.

  • 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-03T02:35:27+00:00Added an answer on June 3, 2026 at 2:35 am

    Your setting the values, but not writing to file.

    [savedEnginePropertiesDict writeToFile: plistPath atomically: YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that serializes a set of objects (using XML serialization) that
I have a parent class which contains a child object. I am using set
I have a Rect object that I'd like to create and set its properties
I have a class that holds another objects inside it (List, Set and objects
I am having a problem accessing the ViewData object through javascript. I have set
I have an object which has several properties that are set when the object
Suppose I have a UserControl whose DataContext is set to an object that has
I'm trying to serialize an object that have a duplicate node name using C#,
I have a Python class that has a class attribute set to something other
So I have a simple validation rule pattern that I'm using to do validation

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.