Graphics Programs Reference
In-Depth Information
{
CLLocationManager *locationManager;
}
- (void)doSomethingWeird;
@end
Build the application again. This time, instead of a warning, you get an error at the point
where doSomethingWeird is sent to self ( Figure 4.15 ).
Figure 4.15 Missing method error
Now the compiler is telling you that this method doesn't exist at all. (If you defined
doSomethingWeird in WhereamiViewController.m above where you called it,
the compiler won't complain. As long as the compiler has seen a declaration or a defini-
tion of the method before it is used, the compiler won't care. However, you should always
declare your methods in the class header file so you don't have to worry about the order of
your methods in the implementation file.)
It is important that you can interpret error and warning messages to understand what
needs to be fixed. These messages may seem arcane, but it is only because they use ter-
minology that you are still becoming familiar with. A suggestion: Whenever you see a
warning or error, write it down somewhere. When you fix it, write down what you did to
fix it.
Remove the line of code that sends doSomethingWeird to self in Wheream-
iViewController.m .
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Create location manager object
locationManager = [[CLLocationManager alloc] init];
[self doSomethingWeird];
Your application should run correctly again. Build and run to make sure before heading to
the next chapter.
 
 
Search WWH ::




Custom Search