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 had this one sorted but I have run into a snag.
I thought I had this all figured out, but now that I'm writing a
I thought I had this answered from a previous post, but I still can't
I thought I had this mess sorted out in my head but for some
OK. So I thought I had this licked ... but now .... I have
I thought I had this figured out but it turns out I'm just deleting
Alright, I thought I had this whole setTimeout thing perfect but I seem to
I thought I had resolved this but I obviously haven't and was hoping someone
I thought I had this perfectly working but apparently not. I left my project
I thought I had this all figured out, but I'm hitting a brick wall.

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.