Note that there are some explanatory texts on larger screens.

plurals
  1. POCompiler error - iOS "expected ")" before "Question
    text
    copied!<p>What's wrong with the following code? Xcode 4 is saying that the two method declarations with "Question" don't compile due to an '"expected ")" before "Question"; message, as indicated in the comments in the code below. The Question class compiles and this code has been working previously. I made some changes to Questions, but backed them out to try to figure out this compile time error. </p> <pre><code>#import &lt;Foundation/Foundation.h&gt; #import "Question.h" @interface AppState : NSObject { int chosenAnswer; int correctAnswers; int currentQuestionNumber; // this will contain the hash table of question objects NSMutableDictionary *questionHash; } @property (nonatomic) int chosenAnswer; @property (nonatomic) int correctAnswers; @property (nonatomic) int currentQuestionNumber; @property (nonatomic, retain) NSDictionary *questionHash; - (void) printQuestions; - (void) printDescription; - (void) addQuestion: (Question *) question; // &lt;==== error - (int) numberOfQuestions; - (void) saveState; - (void) resetState; - (Question *) currentQuestion; // &lt;===== error @end </code></pre> <p>Here's Question.h:</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; #import "AppState.h" @interface Question : NSObject { NSString *questionTxt; int correctAnswer; int number; // this will contain the hash table of questions_answer objects NSMutableDictionary *answerHash; } @property (nonatomic, retain) NSString * questionTxt; @property (nonatomic) int correctAnswer; @property (nonatomic) int number; @property (nonatomic, retain) NSMutableDictionary *answerHash; -(void) addAnswer: (NSString *) answer; - (NSMutableArray *) answerArray; - (void) printDescription; - (void) printAnswers; - (NSString *) correctAnswerText; - (Question *) currentQuestion; @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload