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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:11:22+00:00 2026-05-29T15:11:22+00:00

I am new to Objective-C and iOS development and I’m not sure if I’m

  • 0

I am new to Objective-C and iOS development and I’m not sure if I’m doing it right. Anyway, basically I have a file Configs.plist which, for now has two sets of Keys:Value (Customer:Generic and Short_Code:Default). I want these data to be easily accessible to all classes so I created these:

Configs.h

 extern NSString * const CUSTOMER;
 extern NSString * const SHORT_CODE;

 @interface Configs
 + (void)initialize;
 + (NSDictionary *)getConfigs;
 @end

Configs.m

 #import "Configs.h"

 NSString * const CUSTOMER = @"Customer";
 NSString * const SHORT_CODE = @"Short_Code";

 static NSDictionary *myConfigs;

 @implementation Configs
 + (void)initialize{
     if(myConfigs == nil){
         NSString *path = [[NSBundle mainBundle] pathForResource:@"Configs" ofType:@"plist"];
         settings = [[NSDictionary alloc] initWithContentsOfFile:path];
     }
 }

 + (NSDictionary *)getConfigs{
     return settings;
 }
 @end

And on a the test file Test.m:

 NSLog(@"Customer: %@", [[Configs getConfigs] objectForKey:CUSTOMER]);
 NSLog(@"Short Code: %@", [[Configs getConfigs] objectForKey:SHORT_CODE]);

The thing is, this approach works but I want to know if there are better ways to do this.

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

    I think this is good as long as your configuration does not change during execution. If it does, you’re better off with the singleton exposing your config as properties, so you would be able to do something like this:

    [[Config shared] customer];
    [[Config shared] setShortCode:@"CODE"];
    

    You could still init the config from the plist, or implement coding protocol to store it in the NSUserDefaults.

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

Sidebar

Related Questions

fairly new to Objective-C and iOS development (coming from PHP) and I have a
I am very new at iOS and objective-c development, so I am struggling with
I'm new in objective-c. I have a path to file contained in an NSString
So I'm new to iOS development and am doing all I can to learn
First, I am super-new to Objective-C/iOS development and, in fact, this question is for
I'm new to Objective-C and iOS development, but I was wondering if there was
I am relatively new to Objective C/iOS development so I realize that this may
I'm new to objective-c and iOS development. I need an iPad application to display
I'm new to Objective-C world. What I have noticed while studying some iOS/Mac apps
I am relatively new to Objective-C and iOS development. What I want to do

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.