iphone - Geolocation only shows global map -


I've shown in this tutorial exactly as trying to goelocation my iPhone app: My problem is when I did not track the map and see the geolocation service on my map, so I just look at the global map :( Here my code I hope you can help me to problemify the problem:

Appdelegate.h

  @interface whereAmIAppDelegate: NSObje ct & lt; UIApplicationDelegate, CLLocationManagerDelegate & gt; {UIWindow * window; Jhanamiviwu controller * View Controller; CLLocationManager * locationManager;} @ property (non-creative, sustaining) IBOutlet UIWindow * window; @ property (nonatomic, retain) CLLocationManager * locationManager; maintaining @property (nonatomic,) IBOutlet WhereAmIViewController * ViewController;   

AppDelegate.m:

  @implementation WhereAmIAppDelegate @synthesize window; @ Syntax view controller; @ Synthesis Location Manager; #pragma mark - #pragma mark application lifecycle - (BOOL) application: (UIApplication *) has FinishLaunchingWithOptions: (NSDictionary *) launchOptions {// Override point for customization after application launch Self.locationManager = Application [[[CLLocationManager alloc ] Init] autorelease]; If ([CLLocationManager Location Services is activated]) {self.locationManager.delegate = self; Self.locationManager.distanceFilter = 100; [Self.locationManager startupdating location]; } // Add a view of the view controller in the window and display. [Add window] View: Controller view; [Window-making and knowledgeable]; Yes come back } - (zero) DLock {[viewController release]; [Window release]; [Super DeLoc]; } #pragma mark CLLocationManagerDelegate methods - (void) locationManager: (CLLocationManager *) manager didUpdateToLocation: (CLLocation *) newLocation fromLocation: (CLLocation *) oldLocation {MKCoordinateSpan period; Span.latitudeDelta = 0.2; Span.longitudeDelta = 0.2; MKCoordinateRegion area; Region.span = period; Region.center = newLocation.coordinate; [ViewController.mapView Set Region: Area is Animated: Yes]; ViewController.mapView.showsUserLocation = Yes; ViewController.latitude.text = [NSString stringWithFormat: @ "% f", newLocation.coordinate.latitude]; ViewController.longitude.text = [NSString stringWithFormat: @ "% f", new location.Cordinate. Lame]; } @and   

Myvievkantrolrkh

  @intrfaes Whereamiviawkantrolr: Uivievkantrolr {Mkmpviev * Mpviev; UILBL * latitude; UILBL * longitude; } @ Property (non-monomeric, intact) IBOutlet MKMapView * mapView; @protecti (nonatomic, retten) IBotlate UILb * latitude; @protecti (nonatomic, intact) IBOutlet UILabel * Longitude;   

myViewController.m:

  @implementation WhereAmIViewController @synthesize MapView; @ Synthesis latitude; @ Synthesis longitude; - (zero) Dailyock [[see map release]; [Latitude release]; [Latitude release]; [Super DeLoc]; } @end    

To check two things: 1) the simulator does not place It will always show late / tall at Apple headquarters in California. 2) It takes a little time to decide the location, so if you ask for the location immediately you will not get one.

In addition, you need some more code in your where AMI view controller will usually look something in viewWillAppear . It will probably help you on the scene controllers and map scenes.

Comments