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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:04:47+00:00 2026-05-11T00:04:47+00:00

Still new to Objective C, and I’m having some trouble that I just can’t

  • 0

Still new to Objective C, and I’m having some trouble that I just can’t seem to figure out on my own. The error occurs twice for each of the first three @properties below, and is: error: ‘syntax error before ‘)’ token’.

#import <Foundation/Foundation.h>      @interface PolygonShape : NSObject {     int *numberOfSides;     int *minimumNumberOfSides;     int *maximumNumberOfSides; }  @property (setter = setNumberOfSides) int *numberOfSides; @property (setter = setMin) int *minimumNumberOfSides; @property (setter = setMax) int *maximumNumberOfSides; @property (readonly, getter = angleInDegrees) float *angleInDegrees; @property (readonly, getter = angleInRadians) float *angleInRadians; @property (readonly, getter = name) NSString *name;  - (id) init; - (id) initWithSides: (int*) sides  min: (int*) min  max: (int*) max; - (void) dealloc; - (BOOL) setNumberOfSides: (int*) num; - (void) setMin: (int*) num; - (void) setMax: (int*) num; - (void) description; - (float*) angleInDegrees; - (float*) angleInRadians; - (NSString*) name;  @end 

Not sure if this would make a difference, but here is a summarized version of the implementation:

#import 'PolygonShape.h';  @implementation PolygonShape  @synthesize numberOfSides; @synthesize minimumNumberOfSides; @synthesize maximumNumberOfSides;  ...  - (BOOL) setNumberOfSides: (int*) num {     if(num > minimumNumberOfSides && num < maximumNumberOfSides) {         [numberOfSides release];         numberOfSides = [num retain];         return YES;     } else {         NSLog(@'Number %i is out of range %i to %i', num, minimumNumberOfSides, maximumNumberOfSides);         return NO;     } }  - (BOOL) setMin: (int*) num {     if(num > 2 && num <= maximumNumberOfSides) {         [minimumNumberOfSides release];         minimumNumberOfSides = [num retain];         return YES;     } elseif (num > 2 && maximumNumberOfSides == nil) {         [minimumNumberOfSides release];         [self setMax: 12];         minimumNumberOfSides = [num retain];         return YES;     } elseif (num > 2) {         NSLog(@'Polygons must have more than 2 sides.');         return NO;     } else {         NSLog(@'Please enter a number less than or equal to %i, the current maximum', maximumNumberOfSides);         return NO;     } }  - (void) setMax: (int*) num {     if(num <= 12 && num < maximumNumberOfSides) {         [maximumNumberOfSides release];         maximumNumberOfSides = [num retain];     } elseif (num <= 12) {         NSLog(@'Please enter a number less than or equal to 12');     } else {         NSLog(@'Please enter a number greater than or equal to %i, the current minimum', minimumNumberOfSides);     } }  ...  @end 

Thanks in advance for your help!

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T00:04:48+00:00Added an answer on May 11, 2026 at 12:04 am

    You’re using the wrong selectors on your setter properties. The full selector name includes the colon at the end: setNumberOfSides:

    They should look like this:

    @interface Foo @property (readwrite, setter = setNumberOfSides:) int numberOfSides; @end 

    One thing though, the names you’re specifying are the same as the automatically generated names so you don’t need to specify the setter attribute.

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

Sidebar

Related Questions

I'm still new to Objective-C and having some difficulties trying to figure out the
I am still new to objective-c and am trying to figure out what this
I'm new to Objective-C here, and still learning its syntax, so I'm experimenting some
I'm new to Objective-C and can't seem to get the memory management code right.
I'm still pretty new to Cocoa/Objective-C, so I hope I can explain my question.
I'm rather new to Objective-C and iOS development, and after having read some of
I am still new to Objective C and I was wondering if there were
First off I am still new to objective-c and still trying to learn as
I am still new at SAS and I was wondering how I can do
So I'm still very new to this whole objective C think and I ran

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.