Reputation: 21924
I have a MKMapView with it's delegate set to my controller (m) class.
Code below:
-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Create location manager object
locationManager = [[CLLocationManager alloc] init];
// Make this instance of WhereamiAppDelegate the delegate
// it will send its messages to our WhereamiApplDelegate
[locationManager setDelegate:self];
// We want all results from the location manager
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[mapView setShowsUserLocation:YES];
[window makeKeyAndVisible];
return YES;
}
However, all I am seeing is a map of the world without a blue annotation dot?
Upvotes: 0
Views: 1766
Reputation: 3963
self.mapview.mapType = MKMapTypeStandard;
self.mapview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.mapview.showsUserLocation = YES;
This is all you need if you have a pointer to your map called mapView, but as Merky said, you need a real device. What you can do though is, when the simulator is running, go to "Debug ->location -> own location" and input the coords of your desired coordinate.
Upvotes: 1
Reputation: 494
The simulator does not "really" support that. If you bypass enough checks, it will display Apple's HQ. Any GPS testing you need a real device.
EDIT: I believe that you can drop a pin and it will display that but as far as callbacks from CLLocationManager (via CLLocationManagerDelegate), it ain't happin in the simulator; at least the most recent ones. I can't speak for anything prior to 3.0...
Upvotes: 1