views:

41

answers:

2

And also how to solve an "expected ';' before '{' token? code below (from xcode 3.2.3)

- (void)viewDidUnload {

    self.cheatName = nil;

    self.description = nil;

}

Both errors are in the first line

- (void)viewDidLoad {
    [super viewDidLoad];

    [self.titleLabel setText:self.title];
    [self.descriptionLabel setText:self.description];


    float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description : descriptionLabel.font :descriptionLabel.frame.size.width :UILineBreakModeWordWrap];

    CGRect frame = descriptionLabel.frame;
    frame.size.height = textHeight;
    descriptionLabel.frame = frame;

    CGSize contentSize = descriptionScrollView.contentSize;
    contentSize.height = textHeight;
    descriptionScrollView.contentSize = contentSize;



- (void)viewDidUnload {
    self.cheatName = nil;
    self.description = nil;

}
A: 

usually that means that you have an error somewhere above that line. Or misplaced { }.

Zepplock
it is an .m file
nolimitsplayer
http://pastebin.com/g0sBYD2J
nolimitsplayer
lines 27, 28? One too many I think.
Zepplock
+6  A: 

Your are missing a closing bracket:

- (void)viewDidLoad {
    [super viewDidLoad];

    [self.titleLabel setText:self.title];
    [self.descriptionLabel setText:self.description];


    float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description : descriptionLabel.font :descriptionLabel.frame.size.width :UILineBreakModeWordWrap];

    CGRect frame = descriptionLabel.frame;
    frame.size.height = textHeight;
    descriptionLabel.frame = frame;

    CGSize contentSize = descriptionScrollView.contentSize;
    contentSize.height = textHeight;
    descriptionScrollView.contentSize = contentSize;

} // <-- HERE

- (void)viewDidUnload {
    self.cheatName = nil;
    self.description = nil;

}

Second, I am not sure whether this line is valid:

float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description : descriptionLabel.font :descriptionLabel.frame.size.width :UILineBreakModeWordWrap];

I think you have to add the parameter names like (fictive names!):

float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description font: descriptionLabel.font width:descriptionLabel.frame.size.width whatever:UILineBreakModeWordWrap];
Felix Kling
Then I get an error later down the line:- (void)viewDidUnload { self.cheatName = nil; self.description = nil; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use.} - (void)dealloc { [titleLabel release]; [descriptionLabel release]; [descriptionScrollView release]; [cheatName release]; [description release]; [super dealloc];}}@end
nolimitsplayer
@nolimitsplayer: Which error?
Felix Kling
the error is at the two brackets at the end - it says I need a "(" before "}" tokenIf I remove it, then there are a whole load more errors that have no meaning to the project (like 35 or so)
nolimitsplayer
@nolimitsplayer: It is hard to tell without the the whole code. I suggest to go through your code, fold the methods and see if the folding is done correctly. Verify that the number of opening and closing brackets are the same, etc.
Felix Kling
Can I upload the file to you?
nolimitsplayer
Wait no it is like 65MB for a simple application (WTF)I don't know what to do. All of the brackets are where they should be, etc.What can I do? I don't feel like fixing all of it over again.
nolimitsplayer
The syntax `[o foo:a :b :c]` is actually valid, but it refers to the selector `foo:::` instead of `foo:bar:baz:`.
tc.
Paste it on pastebin?
tc.
What does that mean?I'm pretty much done with the project. (Unless someone wants to work on it with me)
nolimitsplayer
http://pastebin.com/g0sBYD2JThe double brackets right before the viewdidunload thing is where the trouble is.
nolimitsplayer
@nolimitsplayer: Now you have two brackets, in line 27 and 28. Remove one.
Felix Kling
If I do there is a massive error breaking out, with referencing weird files:http://imgur.com/5c3tQ.png
nolimitsplayer