0

i am getting current attitude and longitude of device and print it with nslog but now how will update these latttitude and longitude on map accordingly. here is my code please look at this.

- (void)viewDidLoad {
[super viewDidLoad];



GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868
                                                        longitude:151.2086
                                                             zoom:12];

mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];



mapView_.settings.myLocationButton = YES;
self.view = mapView_;
mapView_.settings.compassButton = YES;

[self startStandardUpdates];

  }



           - (void)startStandardUpdates
        {
// Create the location manager if this object does not
// already have one.

NSLog(@"startupdatelocation");
if (nil == _locationManager)
    _locationManager = [[CLLocationManager alloc] init];

_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;

// Set a movement threshold for new events.
_locationManager.distanceFilter = 10; // meters

[self.locationManager startUpdatingLocation];
        }



         - (void)startSignificantChangeUpdates
        {
// Create the location manager if this object does not
// already have one.
if (nil == _locationManager)
    _locationManager = [[CLLocationManager alloc] init];

_locationManager.delegate = self;
[self.locationManager startMonitoringSignificantLocationChanges];
       }

      - (void)locationManager:(CLLocationManager *)manager
 didUpdateLocations:(NSArray *)locations {
// If it's a relatively recent event, turn off updates to save power.
CLLocation* location = [locations lastObject];
NSLog(@"location %@", location);
NSDate* eventDate = location.timestamp;
NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
if (abs(howRecent) < 15.0) {
    // If the event is recent, do something with it.
    NSLog(@"latitude %+.6f, longitude  %+.6f\n",location.coordinate.latitude,
          location.coordinate.longitude);



        }
      }

i am printing current latitude and longitude now how will i show this location on map also please help me in this situation.

sandeep tomar
  • 303
  • 1
  • 5
  • 17

1 Answers1

0

Current device location should be requested from the iOS - https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html

than you could show the marker with device location on the map

Yauheni Shauchenka
  • 753
  • 1
  • 9
  • 26
  • should i add key value in plist for this "UIRequiredDeviceCapabilities"? – sandeep tomar Apr 07 '16 at 13:39
  • @sandeeptomar NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription are needed keys. Read more for example here http://stackoverflow.com/questions/26134641/how-to-get-current-location-lat-long-in-ios-8 – Yauheni Shauchenka Apr 07 '16 at 13:46