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
Jamie Baker
5,703 PointsAnnoyingly I'm very stuck on this question! Help much appreciated.
Let's warm up our fingers with a quick debugging exercise! There are three errors in this code. Fix them so that this app compiles and runs.
import "JonyIveViewController.h"
@implementation JonyIveViewController
(void)viewDidLoad { [super viewWillAppear:NO]; // Rest of viewDidLoad code omitted
-
(IBAction)redesignIOS:(id)sender {
// Magic redesign code omitted
NSLog("True simplicity is...where you go, 'Yeah, well, of course.'"); }
@end
I've added the closing curly brackets for viewdidload. ive also changed it to super viewDidLoad. Struggling to work out what the 3rd error is!
5 Answers
Steve Smith
12,956 PointsNSLog("True simplicity...
should be
NSLog(@"True simplicity...
agreatdaytocode
24,757 PointsTry this:
@implementation JonyIveViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Rest of viewDidLoad code omitted
}
- (IBAction)redesignIOS:(id)sender {
// Magic redesign code omitted
NSLog(@"True simplicity is...where you go, 'Yeah, well, of course.'");
}
@end
Stone Preston
42,016 Pointscan you post a link to the challenge?
so right now you have
import "JonyIveViewController.h"
@implementation JonyIveViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Rest of viewDidLoad code omitted
}
- (IBAction)redesignIOS:(id)sender {
// Magic redesign code omitted
NSLog("True simplicity is...where you go, 'Yeah, well, of course.'");
}
@end
correct?
I cant really find anything else wrong with it after fixing those. is there a header file?
Jamie Baker
5,703 PointsStone Preston
42,016 Pointslooking at the error code it shows this:
no matching function for call to 'CustomNSLog'
NSLog("True simplicity is...where you go, 'Yeah, well, of course.'");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: expanded from macro 'NSLog'
#define NSLog(...) CustomNSLog(__VA_ARGS__);
^~~~~~~~~~~
note: candidate function not viable: no known conversion from 'const char [60]' to 'NSString *' for 1st argument
void CustomNSLog(NSString *format, ...) {
^
1 error generated.
im not really sure what that means. I guess it could be referencing some TTH challenge engine stuff. CustomNSLog is not anywhere in the code. I really have no idea whats wrong haha. Ben Jakuben any ideas?
Anthony Martinez
13,111 Points1) add [super viewDidLoad] 2) close viewDidLoad brackets (e.g. viewDidLoad {....} <--- second bracket is missing 3) add @ symbol before the string literal.
Stone Preston
42,016 PointsStone Preston
42,016 Pointsah good eye. Ive been writing to much swift code lately. completely forgot about objective c string literals