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

  • Home
  • SEARCH
  • 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 7627041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:24:24+00:00 2026-05-31T05:24:24+00:00

I have made a very simple NSObject: GameSetUpData.h @interface GameSetUpData : NSObject @property (readwrite,

  • 0

I have made a very simple NSObject:

GameSetUpData.h

@interface GameSetUpData : NSObject

@property (readwrite, nonatomic)    NSUInteger      numberOfPlayers;
@property (strong, nonatomic)       NSMutableArray  *playerNames;
@property (strong, nonatomic)       NSString        *gameType;
@property (readwrite, nonatomic)    NSUInteger      numberOfMinutes;
@property (readwrite, nonatomic)    NSUInteger      numberOfTurns;
@property (readwrite, nonatomic)    CGSize          boardSize;

@end

GameSetUpData.m

#import "GameSetUpData.h"

@implementation GameSetUpData

@synthesize numberOfPlayers = _numberOfPlayers;
@synthesize playerNames = _playerNames;
@synthesize gameType = _gameType;
@synthesize numberOfMinutes = _numberOfMinutes;
@synthesize numberOfTurns = _numberOfTurns;
@synthesize boardSize = _boardSize;

@end

This class basically just holds data. I then try to use this object in my viewcontroller:

MainMenu.h

#import <UIKit/UIKit.h>
@class GameSetUpData;

@interface MainMenu : UIViewController

@property (strong, nonatomic) GameSetUpData *gameSetUp;

-(IBAction)tappedNewGame:(id)sender;
-(IBAction)tappedTwoPlayers:(id)sender;
...

MainMenu.m

#import "MainMenu.h"
#import "MJViewController.h"
#import "GameSetUpData.h"

@implementation MainMenu
@synthesize gameSetUp = _gameSetUp;

...

-(IBAction)tappedTwoPlayers:(id)sender {
    _gameSetUp.numberOfPlayers = 2;
    NSLog(@"number of Players: %d", _gameSetUp.numberOfPlayers);
}

Unfortunately, my NSLog says that numberOfPlayers is equal to 0. What is wrong with my GameSetUpData? I was told that in iOS5 we do not need to call alloc/init or make a dealloc method. Do I still need a -(void)init method in GameSetUpData. Thank you all for your time!

Edit: Please alloc/init your objects — ARC ONLY deals with release/retain/autorelease. You still need to make an instance of an Object! I apologize for the mis-information. I will make sure to RTFM next time…

  • 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-31T05:24:25+00:00Added an answer on May 31, 2026 at 5:24 am

    Of course you have to alloc/init your object. How should the compiler know when to do that? With ARC you just don’t need to retain or release.

    Add _gameSetUp = [[GameSetUpData alloc] init]; somewhere.

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

Sidebar

Related Questions

in my application I made a very simple binding. I have a NSMutableArray bound
I have made a very simple AppleScript to close tabs in Safari. The problem
I have made a very simple Pie Graph generator using Javascript & SVG graphics.
I am a rather new C++ programmer. I have made a very simple game
I have made a very simple custom object pictureData . Here is the .h
i have made a very simple labview VI which has an activeX component in
I am puzzled by this: I have made a very simple example: MainWindow.xaml: <Window
I have made a deployment project for my very simple .Net 4.0 C# Winforms
I have a very simple openGL program in C++. I have made a Sphere
I just made a very simple website, but I have run into a problem.

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.