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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:28:00+00:00 2026-05-15T10:28:00+00:00

I thought I had this sorted, but I am still missing something. Very simply,

  • 0

I thought I had this sorted, but I am still missing something.

Very simply, I have a Settings class that hold a DAO (sitting on a plist). I want to have a couple of enums for the settings for convenience and readability, such as GamePlayType and DifficultyLevel. Right now I am defining them in the Settings.h file above the @interface line as such:

typedef enum {
 EASY,
 NORMAL,
 HARD
} DifficultyLevel;

and

typedef enum {
 SET_NUMBER_OF_MOVES,
 TO_COMPLETION
} GamePlayType;

If I access them from within the Settings class like:

- (int)gridSizeForLOD {
 switch ([self difficultyLevel]) {
  case EASY:
   return GRID_SIZE_EASY;
  case NORMAL:
   return GRID_SIZE_NORMAL;
  case HARD:
   return GRID_SIZE_HARD;
  default:
   return GRID_SIZE_NORMAL;
 }
}

everything is fine.

But, if I try to access them outside of the Settings class, let’s say in my main view controller class, like this:

if (([settings gameType] == SET_NUMBER_OF_MOVES) && (numMoves == [settings numMovesForLOD])) {
    [self showLoseScreen];
}

I get errors (like EXC_BAD_ACCESS) or the condition always fails. Am I doing something incorrectly?

Also, I should point out that I have this code for the call to gameType (which lives in the Settings class):

- (GamePlayType)gameType {
    return [dao gameType];
}

and the DAO implements gameType like this:

- (int)gameType {
    return (settingsContent != nil) ? [[settingsContent objectForKey:@"Game Type"] intValue] : 0;
}

I know I have the DAO returning an int instead of a GamePlayType, but A) the problem I am describing arose there when I tried to use the “proper” data type, and B) I did not think it would matter since the enum is just a bunch of named ints, right?

Any help, greatly appreciated. I really want to understand this thoroughly, and something is eluding me…

Cheers,

Chris

  • 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-15T10:28:01+00:00Added an answer on May 15, 2026 at 10:28 am

    If you don’t have it there already you’ll need an import like below in your other class

    #import "Settings.h"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought I heard that py2exe was able to do this, but I never
I thought I had seen a bug report about this on the jQuery site,
This may seem like a programming 101 question and I had thought I knew
I long thought that in C, all variables had to be declared at the
Curious to get people's thoughts. I conduct frequent interviews, and have had enough in
I thought that there was some way in .net 3.0 to give an array
I'd like the community's take on some thoughts I've had about Linq to Sql
I haven't had to interact w/MSSQL much in my development career, though I've spent
I thought .Net code gets compiled into MSIL, so I always wondered how do
I thought jQuery Intellisense was supposed to be improved with SP1. I even downloaded

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.