Como desarrollar una App estilo Uber para el mercado Mexicano. Se explicaran el uso de frameworks de websockets, geolocalización, pagos y más.
Fernando Gutiérrez Lozano (@fernando_gl_) y Salvador Rodríguez Dávila (@srdzdv)
10. google maps sdk
- (void)viewDidLoad {
// Init Google Maps View
self.mapView.delegate = self;
// Init Google Maps Camera Object with device's currrent location
camera = [GMSCameraPosition cameraWithLatitude:currentLatitude
longitude:currentLongitud
zoom:14]; // default = 15
[self.mapView setCamera:camera];
// Creates a marker in the center of the map.
greenMarker = [[GMSMarker alloc] init];
greenMarker.icon = [UIImage imageNamed:@"centerPositionMapDot"];
greenMarker.map = self.mapView;
destinationMarker = [[GMSMarker alloc] init];
// Driver marker init
chofer1Marker = [[GMSMarker alloc] init];
chofer1Marker.icon = [UIImage imageNamed:@"basicCarIconBlack"];
chofer1Marker.map = self.mapView;
}
Inicializar Mapa y custom markers
11. google maps sdk
<key>NSLocationAlwaysUsageDescription</key>
<string>iter necesita acceso a tu ubicación para poder funcionar
correctamente. Gracias.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>iter necesita acceso a tu ubicación para poder funcionar
correctamente. Gracias.</string>
Inicializar location manager
info.plist
12. google maps sdk
// This method receives a 2D coordinte and uses the reverseGeocodeCoordinate to get the street address from the
coordinate.
// It also updates the userpickup lat & lng global variables
- (void)getCurrentUserAddressForCoordinate:(CLLocationCoordinate2D)geoCodeCoordinate {
if (debug==1) {
NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));
}
// Set User long & lat for pickup
userPickupLatitude = geoCodeCoordinate.latitude;
userPickupLongitud = geoCodeCoordinate.longitude;
GMSGeocoder *geocoder = [[GMSGeocoder alloc] init];
[geocoder reverseGeocodeCoordinate:geoCodeCoordinate completionHandler:^(GMSReverseGeocodeResponse *geocodeResponse,
NSError *error){
if (!error) {
GMSAddress *addressResponse = [geocodeResponse firstResult];
NSArray *addressLineArray = addressResponse.lines;
self.riderOriginAddressTextField.text = addressLineArray[0];
[self validateCurrentLocationIsActiveForCity:addressResponse.locality];
}
}];
}
google Maps Geocoding API