Conecta
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
¿Alguien sabe arreglar este error?
- preguntó
- Desarrolladores Apple
- 245 Vistas
- 5 Respuestas
- abierta
Uploaded with ImageShack.us
5 Respuestas
Por favor, accede o regístrate para añadir un comentario.
[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]
Por favor, accede o regístrate para añadir un comentario.
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.
Por favor, accede o regístrate para añadir un comentario.
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!!
Por favor, accede o regístrate para añadir un comentario.
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 añadir un comentario.
Por favor, accede o regístrate para responder a esta pregunta.
En el blog
-
- 52513
- 1
- Ago 31, 2017
Otras Preguntas y Respuestas
- entre Desarrolladores (Desarrolladores)
Respuestas WordPress (Usuarios WordPress)
Sin Respuesta
-
- 57
- 0
- Feb 23
-
- 108
- 0
- Dic 7, 2023
-
- 108
- 0
- Nov 30, 2023
-
- 449
- 0
- Jul 7, 2023
-
- 624
- 0
- Ago 4, 2022
-
- 677
- 0
- Feb 25, 2022
-
- 752
- 1
- Ene 1, 2022
-
- 1124
- 0
- Nov 24, 2021
- ver todas
Preguntas relacionadas
Actividad Reciente
mozzer respondió hace 22 horas
Organizador VisualPeter respondió hace 22 horas
Organizador Visualmozzer preguntó hace 1 día
Organizador VisualDaleGarrote respondió Mar 30
Liada con biblioteca de MusicaDaleGarrote preguntó Mar 27
Liada con biblioteca de Musica
Ultimas Respuestas
mozzer respondió
0Peter respondió
Si es por el sistema, ya que requieres macOS Ventu
1DaleGarrote respondió
Bueno, estoy probando y no doy en la tecla. Decid�
0ppenagosr respondió
Muchas gracias por tu respuesta; cometí el error
0DaleGarrote respondió
La solución: pillé una tarjeta AirPort por eBay,
0DaleGarrote respondió
Prueba con Adobe Bridge, entre otras cosas, te per
0DaleGarrote respondió
No doy en la tecla, como os comenté la App UltDat
0Ultimos Comentarios
Preguntas relacionadas
...