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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:38:53+00:00 2026-06-14T02:38:53+00:00

Probably a noob problem but here it is. I have my AppDelegate instantiating a

  • 0

Probably a noob problem but here it is. I have my AppDelegate instantiating a new dictionary from a file in “application didFinishLaunchingWithOptions”. I have an addViewController that I would like to pass a new object to be added to the AppDelegate’s dictionary, for later saving to disk. Here’s some snippets of what I’ve got.

//
//  AppDelegate.m
//  PersonLibraryiOS
//
//  Created by Joey on 11/7/12.
//  Copyright (c) 2012 Joey. All rights reserved.
//

#import "AppDelegate.h"
#import "AddViewController.h"
#import "Person.h"
@implementation AppDelegate
@synthesize PersonDict;

-(void)addtoDict:(Person *)newPerson
{
    [PersonDict setObject:@"newPerson" forKey:[newPerson name]];
}



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    return YES;
    PersonDict = [NSMutableDictionary dictionaryWithContentsOfFile:@"diskDict"];

and the AddViewController:

//
//  AddViewController.m
//  personLibraryiOS
//
//  Created by Joey on 11/8/12.
//  Copyright (c) 2012 Joey. All rights reserved.
//

#import "AddViewController.h"
#import "TableViewController.h"
#import "person.h"
#import "AppDelegate.h"

@implementation AddViewController
@synthesize nameLabel;
@synthesize ageLabel;
@synthesize heightLabel;
@synthesize weightLabel;
@synthesize hairColorLabel;
@synthesize eyeColorLabel;


- (IBAction)saveButton:(id)sender
{
    person *newperson = [[person alloc]init];

    newperson.name = [nameLabel text];
    newperson.age = [ageLabel text];
    newperson.height = [heightLabel text];
    newperson.weight = [weightLabel text];
    newperson.hairColor = [hairColorLabel text];
    newperson.eyeColor = [eyeColorLabel text];



    [AppDelegate addtoDict:newperson];  <---- the error is here

     }

I know this is probably basic but I’m really confused. I’m importing the AppDelegate.h file in the addViewController, so it should know all about AppDelegate’s methods.

Thanks everyone.

  • 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-14T02:38:55+00:00Added an answer on June 14, 2026 at 2:38 am

    The line:

    [AppDelegate addtoDict:newperson];
    

    is attempting to call a class method named addtoDict: on the the class named AppDelegate. Most likely you want to call the addtoDict: instance method (not class method) on your app’s app delegate instance.

    You probably want:

    [(AppDelegate *)[NSApplication sharedApplication].delegate addtoDict:newperson];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

sorry for the (probably) noob question, but I', new at this stuff. i have
I'm a noob so this is probably basic stuff, but I have tried to
This is probably a noob question that I will get slated for but here
i've a strange problem with JS (probably a noob bug), but i'm stuck with
Noob in mod_rewrite here...I'm developing a new site and using mod_rewrite. The problem is,
This is probably a noob problem. For that I apologize, but I couldn't find
This will probably seem like a noob question but I have managed to intall
Probably a simple problem here, but this is my use case: Need to see
I am a Rails noob and have a problem sending an email from a
Another noob regex problem/question. I'm probably doing something silly so I thought I'd exploit

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.