Nido Apple

Recibe ayuda de expertos

Registrate y pregunta

Es gratis y fácil

Recibe respuestas

Respuestas, votos y comentarios

Vota y selecciona respuestas

Recibe puntos, vota y da la solución

Pregunta

0voto

¿Alguien sabe arreglar este error?

image Uploaded with ImageShack.us

5 Respuestas

0voto

Peter Puntos289100
Pon el código en otro mensaje, para así poder copiarlo y hacer pruebas :) Saludos.

0voto

markfree Puntos4510
[PHP]-(void) loadRoute { NSURL *URL =[NSURLURLWithString:@"http://argosengine.com/patum/consultasalts.php?dia=1"]; NSData *datos = [[NSDataalloc]initWithContentsOfURL:URL]; NSString *datos_string = [[NSStringalloc]initWithData:datos encoding:NSUTF8StringEncoding]; SBJsonParser *parser = [[SBJsonParseralloc]init]; NSArray *datos_array = [[NSArray alloc]initWithArray:[parser objectWithString:datos_string error:nil]]; ultimarray = [[NSMutableArrayalloc]init]; for (NSDictionary *items in datos_array) { latitud = [[items objectForKey:@"salt_lat"]floatValue] ; longitud = [[items objectForKey:@"salt_lon"]floatValue] ; pointstring = [NSString stringWithFormat:@"%f,%f", latitud , longitud]; [ultimarray addObject:[NSString stringWithFormat:@"%f,%f", latitud , longitud]]; // while we create the route points, we will also be calculating the bounding box of our route // so we can easily zoom in on it. MKMapPoint northEastPoint; MKMapPoint southWestPoint; // create a c array of points. MKMapPoint* pointArr = malloc(sizeof(CLLocationCoordinate2D) * ultimarray.count); for(int idx = 0; idx < ultimarray.count; idx++) { // break the string down even further to latitude and longitude fields. NSString* currentPointString = [ultimarray objectAtIndex:idx]; NSArray* latLonArr = [currentPointString componentsSeparatedByCharactersInSet:[NSCharacterSetcharacterSetWithCharactersInString:@","]]; CLLocationDegrees latitude = [[latLonArr objectAtIndex:0] doubleValue]; CLLocationDegrees longitude = [[latLonArr objectAtIndex:1] doubleValue]; // create our coordinate and add it to the correct spot in the array CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(latitude, longitude); MKMapPoint point = MKMapPointForCoordinate(coordinate);// if it is the first point, just use them, since we have nothing to compare to yet. if (idx == 0) { northEastPoint = point; southWestPoint = point; } else { if (point.x > northEastPoint.x) northEastPoint.x = point.x; if(point.y > northEastPoint.y) northEastPoint.y = point.y; if (point.x < southWestPoint.x) southWestPoint.x = point.x; if (point.y < southWestPoint.y) southWestPoint.y = point.y; } pointArr[idx] = point; } self.routeLine = [MKPolylinepolylineWithPoints:pointArr count:ultimarray.count]; _routeRect = MKMapRectMake(southWestPoint.x, southWestPoint.y, northEastPoint.x - southWestPoint.x, northEastPoint.y - southWestPoint.y); // clear the memory allocated earlier for the points free(pointArr); } }[/PHP]

0voto

Peter Puntos289100
Ya que estás usando ese código, completalo de esta forma. Ahí viene el código completo, pero el problema que tiene es que es de hace más de dos años y hay códigos mucho más actuales. La cuesión sería saber que quieres hacer exactamente. Saludos.

0voto

Daniel_ Puntos140
Hola Peter, Yo estoy intentando hacer algo parecido, en concreto un array de CLLocationCoordinate2D, para poder pintar varias posiciones diferentes a la vez en un mapa teniendo su longitud y latitud. Comentas que hay códigos mas actuales para hacer esta tarea. ¿Podrías poner algún link para ver algún ejemplo? Un saludo y muchas gracias!!

0voto

Peter Puntos289100
Bienvenido al sitio Daniel. Por favor más detalles de lo que quieres hacer y que tanto involucra en tu aplicación completa, para tener un panorama amplio de lo que quieres hacer y darte código que te funcione bien. Por favor abre un tema nuevo con tu duda y con gusto la resolvemos. Saludos.

Por favor, accede o regístrate para responder a esta pregunta.

Otras Preguntas y Respuestas


...