It has been a few years since I’ve done OO programming, and never with Objective-C, so I’m trying to take this slow and work through each example and understand exactly what is going on. Needless to say, I am very much a newbie with the iOS classes and the reference library.
I have just started chapter 5, having successfully completed chapter 4. I am trying to get the initial build that will ONLY show a map view to display. I don’t want to move on to things like the view problems I’ve seen discussed so far. From the MKMapView class reference, it doesn’t seem like anything I’ve done so far is incorrect, so I must be missing something. But I can’t find it. I’d appreciate some assistance.
Here is my code for WhereAmIappDelegate.h:
@interface WhereamiAppDelegate : NSObject <UIApplicationDelegate, CLLocationManagerDelegate>
CLLocationManager *locationManager; IBOutlet MKMapView *mapView; IBOutlet UIActivityIndicatorView *activityIndicator; IBOutlet UITextField *locationTitleField;
@property (nonatomic, retain) IBOutlet UIWindow *window;
And this is my code for WhereAmIAppDelegate.m:
// Create location manager object -
locationManager = [[CLLocationManager alloc] init];
// Make this instance of WhereamiAppDelegate the delegate
// it will send its messages to our WhereamiAppDelegate
// We want all results from the location manager
// And we want it to be as accurate as possible
// regardless of how much time/power is takes
// Challenge: print the heading information
// First turn on the heading updates with the startUpdatingHeading method
// Then the locationManager:didUpdateHeading method will call the delegate, with the heading
// [locationManager startUpdatingHeading];
// Tell our manager to start looking for its location immediately
// [locationManager startUpdatingLocation];
NSLog(@“Could not find location: %@”, error);
I have also checked the MainWindow.xib multiple times and all of the linkages look correct as far as I can tell:
WhereAmI app delegate has 4 outlets
activityIndicator points to Grey Activity Indicator
locationTitleField points to Round Style Text Field
mapView points to Map View
window points to Window
It also has 3 referencing outlets: delegates
Round Style Text Field
Each of the 4 elements in the interface also show that they have a single Referencing Outlet:Window of WhereAmI app delegate.
When I do a build, the console shows that I have the GDB running, and the simulator appears. The app starts, but nothing happens, just the title bar and a black screen. I have downloaded the example files from the web site and compared the files to my files, and they appear to be the same (up to this point, obviously additions that I am about to get to are missing).
Does anyone have any advice?
– I forgot to mention, this is iOS 4.3