Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Michael Schutz
1,615 PointsError in CGRect and Frame video?
Hi, I've been following the iOS track fine, but ran into an issue at 9:00 on the CGRect and Frame video.
When you add the viewDidAppear method, and then add the line
[super viewDidAppear:animated];
I got an error when running the program - it gave me an "expression expected" error. I triple-checked that I had it exactly the same as on the video, but the error persisted.
I then realized the method call had "BOOL:animated" in it, so I thought maybe XCode was looking for a true or false, and indeed, when I put "true" in place of "animated" in that line, so that it read like this:
[super viewDidAppear:true];
it worked with no errors.
in the video you just kept the argument "animated" in both lines. Could that be due to a new version of XCode? I'm using 5.1.1 - just looking for some clarification about why I had to actually put the Boolean value in that line and you didn't.
Thanks in advance.
3 Answers
Amit Bijlani
Treehouse Guest TeacherYou are taking the argument animated that is passed into the method you are overriding and passing when you call the same method on the super class. It has nothing to do with the version of Xcode. Could it be that you misspelled the word animated in your method signature?
Tyler Hall
Courses Plus Student 933 PointsI was having trouble with this as well, it said I had some thread issue. I downloaded the Project Files (as I was using the project from the previous videos) and the viewDidAppear code worked without errors.
Ben Myhre
28,726 PointsI had this same issue.
For the method:
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
}
When I started typing out the "super viewDid..." portion, I allowed it to autocomplete for me and the 'animated' term still had an appearance as though it was slightly MORE greyed out. SCREENSHOT . It wasn't until I physically typed out "animated" that it allowed me to use it without getting this same error.
Short story... type out 'animated'
Michael Schutz
1,615 PointsMichael Schutz
1,615 PointsThanks Amit, it's possible, but I had triple-checked the whole thing. My ignorance is showing - not sure what happened. I haven't tried getting the project files directly like Tyler said below - I had been just starting over with the same main.m file. At some point I may try that just to see if that makes a difference for me too.