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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:30:00+00:00 2026-06-12T02:30:00+00:00

I need to initialize an object of an object in my AppDelegate at startup.

  • 0

I need to initialize an object of an object in my AppDelegate at startup. Whenever I try to access the ivar somewhere else all that is returned is null.

What I’m doing can be simplified as

//AppDelegate.h:
@interface AppDelegate : UIResponder <UIApplicationDelegate> {
    NSString* someString;
}

@property (nonatomic, copy)   NSString* someString;

and then in the AppDelegate.m

//AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    someString = @"Hello World!";
    NSLog(@"%@",someString);
}

This is what I do when I access the NSString-object

//ViewController.m
- (void)viewDidLoad {
    [super viewDidLoad];
    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

    NSLog(@"%@",delegate.someString);
}

The output text is

  • 2012-09-30 22:26:45.125 Labor3[22524:f803] Hello World!
  • 2012-09-30 22:26:45.127 Labor3[22524:f803] (null)

without any warnings or errors.

The problem I’m having is a bit more complicated but the essentials stay the same and I can’t even get the above example to work. Any hint is appreciated.

  • 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-12T02:30:02+00:00Added an answer on June 12, 2026 at 2:30 am

    Add

    @synthesize someString;
    

    After

    @implementation AppDelegate
    

    in your app-delegate .m file.

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

Sidebar

Related Questions

I'm trying to create a class that inherits NSMutableDictionary. Whenever I initialize an object
I'm developing a few custom ant tasks that all need to initialize the same
Seems like whenever we need to initialize an object, we need to immediately write
me need your adwise: i've got 2 classes, in first I initialize the object
I'm writing a web application and need to initialize some parameters that I'm pulling
To initialize an int array with all zeros, do I need to use: int
I need to initialize my object like below: var obj = new EduBranch {
I need to create an enumeration that I will need to initialize from a
I need to initialize an object in a method without specifying the class from
I understand that Encoding can be used to initialize object to perform any type

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.