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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:57:15+00:00 2026-05-29T21:57:15+00:00

In reference to the answer of this SO question: Keeping track of changes in

  • 0

In reference to the answer of this SO question: Keeping track of changes in a UIView
I need help setting up the global aspect of the NSMutableSet. In my appdelegate.h file I’ve got this:

@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
ViewController *viewController;
NSMutableSet *statesTouched;
}

and this in my appdelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
statesTouched = [[NSMutableSet alloc]init];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}

In my viewcontroller.h file I’m adding the object like this:

[statesTouched addObject:touchedStateName];

but I’m getting an undeclared identifier for statesTouched. I’ve never tried putting something like this into my app delegate and I’m a little confused at how this should be working. Thanks!

  • 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-29T21:57:16+00:00Added an answer on May 29, 2026 at 9:57 pm

    This is because is an instance variable of your AppDelegate, not your view controller. If you move the declaration and the initialization to your view controller, the error will go away. It would not make it a global variable, though, which is good if it works for you.

    If it does not work for you, make the variable a truly global one: move the declaration out of the app delegate, and add extern keyword, like this:

    extern NSMutableSet *statesTouched;
    

    Now add the definition in the .m file, like this:

    NSMutableSet *statesTouched;
    

    Make sure the definition is outside the @implementation block.

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

Sidebar

Related Questions

In reference to this answer to a Stack Overflow question : what is bench-testing
This question is strongly connected to this answer to How to reference a generic
Thanks to this question/answer Automatic Reference Counting: Error with fast enumeration I resolved a
I would really appreciate if you can help to answer to this question: I
Reference: This is a self-answered question. It was meant to share the knowledge, Q&A
In reference with this question We have a header with a date picked component
I was asked this question in an interview: Is string a reference type or
I was looking at the answer of this question regarding multiple generic types in
I have been looking all over the Internet for an answer to this question
In discussion about my answer to this question , there was some disagreement over

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.