(IOS)获取用户坐标

#pragma mark -获取用户坐标

+(NSString*)userLocations{

    CLLocationManager *locationManager = [[CLLocationManager alloc] init];

    [locationManagerrequestWhenInUseAuthorization];

    //    locationManager.delegate = self;

    //    [locationManager startUpdatingLocation];

    //经度

    CGFloatlongitude = [locationManager.locationcoordinate].longitude;

    //纬度

    CGFloatlatitude = [locationManager.locationcoordinate].latitude;

    NSString*userLocations = [NSStringstringWithFormat:@"%lf|%lf",longitude,latitude];

    returnuserLocations;

}

你可能感兴趣的:((IOS)获取用户坐标)