Sqlite 地图套件:注释don';在iPhone中缩放地图后才能显示
我希望单击工具栏按钮(如“Mapa”)后,注释将显示在可见的地图区域中。数据从CoreData(Sqlite)获取。在iPhone模拟器中一切正常,但当我在iPhone上测试应用程序时,单击工具栏上的按钮后只会显示一些PIN,我需要放大和缩小几次才能获得所有PIN 第一个图像()显示屏幕,然后将其放大几倍,第二个()是我希望从一开始就得到的 你能帮我吗?这是密码Sqlite 地图套件:注释don';在iPhone中缩放地图后才能显示,sqlite,core-data,annotations,mapkit,Sqlite,Core Data,Annotations,Mapkit,我希望单击工具栏按钮(如“Mapa”)后,注释将显示在可见的地图区域中。数据从CoreData(Sqlite)获取。在iPhone模拟器中一切正常,但当我在iPhone上测试应用程序时,单击工具栏上的按钮后只会显示一些PIN,我需要放大和缩小几次才能获得所有PIN 第一个图像()显示屏幕,然后将其放大几倍,第二个()是我希望从一开始就得到的 你能帮我吗?这是密码 #import "MapViewController.h" #import "AerodromoAppDelegate.h" #imp
#import "MapViewController.h"
#import "AerodromoAppDelegate.h"
#import "Aerodromo.h"
#import "DetalleViewController.h"
#import <MapKit/MapKit.h>
@implementation mapViewController {
NSArray *locations;
}
@synthesize managedObjectContext;
@synthesize mapView;
- (void)viewDidLoad
{
[super viewDidLoad];
if (self.managedObjectContext == nil)
{
self.managedObjectContext = [(AerodromoAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
NSLog(@"After managedObjectContext: %@", self.managedObjectContext);
}
dispatch_async (dispatch_get_main_queue(), ^{
NSLog(@"Main Thread Code");
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Aerodromo" inManagedObjectContext:self.managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:entity];
NSError *error;
NSArray *foundObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
if (foundObjects == nil) {
NSLog(@"FATAL_CORE_DATA_ERROR(error)");
return;
}
if (locations != nil) {
[self.mapView removeAnnotations:locations];
}
locations = foundObjects;
self.title = @"Mapa Online";
UIBarButtonItem *showuser = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(showUser:)];
UIBarButtonItem *boton = [[UIBarButtonItem alloc] initWithTitle:@"Boton" style:UIBarButtonItemStyleDone target:self action:@selector(boton2:)];
NSArray *botones = [[NSArray alloc] initWithObjects:showuser, boton, nil];
self.navigationItem.rightBarButtonItems = botones;
mapView.delegate = self;
// Creamos una coordenada inicial.
CLLocationCoordinate2D initialLocation;
MKCoordinateRegion region = {{0.0f, 0.0f}, {0.0f, 0.0f}};
region.center = self.mapView.userLocation.location.coordinate;
initialLocation.latitude = self.mapView.userLocation.location.coordinate.latitude;
initialLocation.longitude= self.mapView.userLocation.location.coordinate.longitude;
// Esto situará el centro del mapa
region = MKCoordinateRegionMakeWithDistance(initialLocation, 50000, 50000);
[self.mapView setRegion:region animated:NO];
[self.mapView removeAnnotations:self.mapView.annotations];
NSLog(@"antotaciones = %d", locations.count);
[self.mapView addAnnotations:locations];
self.mapView.showsUserLocation=TRUE;
NSLog(@"fin Thread Code");
}); // termino del queqe
//[self.mapView addAnnotations:locations];
//[self updateLocations];
}
- (void)showUser:(id)sender{
NSLog(@"Boton1");
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(self.mapView.userLocation.coordinate, 50000, 50000);
[self.mapView setRegion:[self.mapView regionThatFits:region] animated:NO];
}
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{
[self.mapView removeAnnotations:self.mapView.annotations];
[self.mapView addAnnotations:locations];
}
- (void)boton2:(id)sender{
NSLog(@"boton 2");
}
#pragma mark - MKMapViewDelegate
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[Aerodromo class]]) {
static NSString *identifier = @"Aerodromo";
MKAnnotationView *annotationView = (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
//annotationView.animatesDrop = NO;
annotationView.image = [UIImage imageNamed:@"aero3.png"];
//annotationView.pinColor = MKPinAnnotationColorGreen;
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self action:@selector(showLocationDetails:) forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView = rightButton;
} else {
annotationView.annotation = annotation;
}
UIButton *button = (UIButton *)annotationView.rightCalloutAccessoryView;
button.tag = [locations indexOfObject:(Aerodromo *)annotation];
return annotationView;
}
return nil;
}
- (void)showLocationDetails:(UIButton *)button
{
NSLog(@"se apreto el boton");
//[self performSegueWithIdentifier:@"EditLocation" sender:button];
}
@end
感谢您在我使用NSLog(@“antotaciones=%d,%@”,locations.count,locations)时对wkberg的帮助;为了知道数据会发生什么情况,我意识到在第7行之后,NSFetchRequest不会加载数据
这是控制台:
2013-07-16 12:10:18.007 Aerodromo[13922:1207] ASync Thread Code
2013-07-16 12:10:18.045 Aerodromo[13922:907] Getting back to the UI
2013-07-16 12:10:18.090 Aerodromo[13922:907] antotaciones = 351, (
"<Aerodromo: 0x1f0b0040> (entity: Aerodromo; id: 0x1f0ad580 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p1> ; data: {\n Ancho1 = 45;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Arica \";\n Desig = SCAR;\n Elev = \"123 -166\";\n FrecTerr = IFR;\n FrecTorre = 1;\n Fuel = JP1;\n Fuel2 = \"AVGAS 100/130\";\n IdAd = 1;\n IndexRegion = 1;\n Larg1 = 2170;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 18;\n LatM = 20;\n LatS = 55;\n Latitud = \"-18.349\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 70;\n LonM = 20;\n LonS = 19;\n Longitud = \"-70.339\";\n Nombre = Chacalluta;\n NumeroPistas = 1;\n Pista1 = \"02-20\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 15;\n Superficie = \"Hormig\\U00f3n\";\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(58) 211116\";\n TieneMetar = 1;\n Uso = \"P\\U00daBLICO\";\n frec = \"<relationship fault: 0x21d8e110 'frec'>\";\n pdf = \"<relationship fault: 0x21d8e460 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0470> (entity: Aerodromo; id: 0x1f098d30 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p2> ; data: {\n Ancho1 = 23;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Arica \";\n Desig = SCAE;\n Elev = 328;\n FrecTerr = 0;\n FrecTorre = 0;\n Fuel = \"No Tiene\";\n Fuel2 = \"\";\n IdAd = 2;\n IndexRegion = 1;\n Larg1 = 800;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 18;\n LatM = 30;\n LatS = 36;\n Latitud = \"-18.51\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 70;\n LonM = 17;\n LonS = 21;\n Longitud = \"-70.289\";\n Nombre = \"El Buitre\";\n NumeroPistas = 1;\n Pista1 = \"09-27\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 15;\n Superficie = Asfalto;\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(58) 201500 Anexo 31216\";\n TieneMetar = 0;\n Uso = MILITAR;\n frec = \"<relationship fault: 0x21e711e0 'frec'>\";\n pdf = \"<relationship fault: 0x21e715e0 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0870> (entity: Aerodromo; id: 0x1f0a09c0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p3> ; data: {\n Ancho1 = 45;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Iquique \";\n Desig = SCDA;\n Elev = \"97-157\";\n FrecTerr = \"VFR - IFR\";\n FrecTorre = 1;\n Fuel = JP1;\n Fuel2 = \"AVGAS 100/130\";\n IdAd = 3;\n IndexRegion = 2;\n Larg1 = 3350;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 20;\n LatM = 32;\n LatS = 07;\n Latitud = \"-20.535\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 70;\n LonM = 10;\n LonS = 53;\n Longitud = \"-70.181\";\n Nombre = \"Diego Aracena\";\n NumeroPistas = 1;\n Pista1 = \"19-01\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 1;\n Superficie = \"Hormig\\U00f3n\";\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(57)461200\";\n TieneMetar = 1;\n Uso = \"P\\U00daBLICO\";\n frec = \"<relationship fault: 0x21e71d00 'frec'>\";\n pdf = \"<relationship fault: 0x21e71e70 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0670> (entity: Aerodromo; id: 0x1f0a09a0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p4> ; data: {\n Ancho1 = 20;\n Ancho2 = 20;\n Ancho3 = \"\";\n Ciudad = \"Pica \";\n Desig = SCKP;\n Elev = 12468;\n FrecTerr = 0;\n FrecTorre = 0;\n Fuel = \"No Tiene\";\n Fuel2 = \"\";\n IdAd = 4;\n IndexRegion = 2;\n Larg1 = 3200;\n Larg2 = 1034;\n Larg3 = \"\";\n LatG = 20;\n LatM = 44;\n LatS = 08;\n Latitud = \"-20.736\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 68;\n LonM = 41;\n LonS = 42;\n Longitud = \"-68.69499999999999\";\n Nombre = Coposa;\n NumeroPistas = 2;\n Pista1 = \"17-35\";\n Pista2 = \"10-28\";\n Pista3 = \"\";\n RegionOrd = 1;\n Superficie = Asfalto;\n Superficie2 = Tierra;\n Superficie3 = \"\";\n Telefono = \"(57)417777\";\n TieneMetar = 0;\n Uso = PRIVADO;\n frec = \"<relationship fault: 0x21e72b80 'frec'>\";\n pdf = \"<relationship fault: 0x21e72f70 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0a50> (entity: Aerodromo; id: 0x1f0907c0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p5> ; data: {\n Ancho1 = 30;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Pozo Almonte\";\n Desig = SCNV;\n Elev = 3172;\n FrecTerr = 0;\n FrecTorre = 0;\n Fuel = \"No Tiene\";\n Fuel2 = \"\";\n IdAd = 5;\n IndexRegion = 2;\n Larg1 = 1077;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 20;\n LatM = 44;\n LatS = \"05,4\";\n Latitud = \"-20.735\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 69;\n LonM = 37;\n LonS = \"32,6\";\n Longitud = \"-69.626\";\n Nombre = \"Nueva Victoria\";\n NumeroPistas = 1;\n Pista1 = \"09-27\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 1;\n Superficie = Vichufita;\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(57) 413620\";\n TieneMetar = 0;\n Uso = PRIVADO;\n frec = \"<relationship fault: 0x21e739e0 'frec'>\";\n pdf = \"<relationship fault: 0x21e73800 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0c20> (entity: Aerodromo; id: 0x1f0920e0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p6> ; data: {\n Ancho1 = 18;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Antofagasta \";\n Desig = SCGU;\n Elev = 3347;\n FrecTerr = 0;\n FrecTorre = 0;\n Fuel = \"No Tiene\";\n Fuel2 = \"\";\n IdAd = 6;\n IndexRegion = 3;\n Larg1 = 1200;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 24;\n LatM = 8;\n LatS = 11;\n Latitud = \"-24.136\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 69;\n LonM = 49;\n LonS = 43;\n Longitud = \"-69.82899999999999\";\n Nombre = \"Aguas Blancas\";\n NumeroPistas = 1;\n Pista1 = \"13-31\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 2;\n Superficie = Tierra;\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(2) 2063737\";\n TieneMetar = 0;\n Uso = PRIVADO;\n frec = \"<relationship fault: 0x21e744d0 'frec'>\";\n pdf = \"<relationship fault: 0x21e74920 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b1020> (entity: Aerodromo; id: 0x1f0a1970 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p7> ; data: {\n Ancho1 = 50;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Antofagasta \";\n Desig = SCFA;\n Elev = \"352- 455\";\n FrecTerr = \"VFR - IFR\";\n FrecTorre = 1;\n Fuel = JP1;\n Fuel2 = \"AVGAS 100/130\";\n IdAd = 7;\n IndexRegion = 3;\n Larg1 = 2599;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 23;\n LatM = 26;\n LatS = 40;\n Latitud = \"-23.444\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 70;\n LonM = 26;\n LonS = 42;\n Longitud = \"-70.44499999999999\";\n Nombre = \"Cerro Moreno\";\n NumeroPistas = 1;\n Pista1 = \"01-19\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 2;\n Superficie = Asfalto;\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(55) 269077\";\n TieneMetar = 1;\n Uso = \"P\\U00daBLICO\";\n frec = \"<relationship fault: 0x21e75370 'frec'>\";\n pdf = \"<relationship fault: 0x21e75190 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b1770> (entity: Aerodromo; id: 0x1f0a41c0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p8> ; data: <fault>)",
"<Aerodromo: 0x1f0b1f00> (entity: Aerodromo; id: 0x1f0ad660 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p9> ; data: <fault>)",
"<Aerodromo: 0x1f0b11e0> (entity: Aerodromo; id: 0x1f071c50 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p10> ; data: <fault>)",
"<Aerodromo: 0x1f0b1b50> (entity: Aerodromo; id: 0x1f0a4930 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p11> ; data: <fault>)",
"<Aerodromo: 0x1f0b13c0> (entity: Aerodromo; id: 0x1f0a3190 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p12> ; data: <fault>)",
2013-07-16 12:10:18.007机场[13922:1207]异步线程代码
2013-07-16 12:10:18.045机场[13922:907]返回用户界面
2013-07-16 12:10:18.090机场[13922:907]antotaciones=351(
“(实体:Aerodromo;id:0x1f0ad580;数据:{\n Ancho1=45;\n Ancho2=\“\”;\n Ancho3=\“\”;\n Ciudad=\“Arica\”;\n Desig=SCAR;\n Elev=\“123-166\”;\n Frecter=IFR;\n Frectore=1;\n Fuel=JP1;\n Fuel2=“AVGAS 100/130\”;\n IdAd=1;\n IndexRegion=1;\n Larg1=2170;\n Larg2=”\“;\n Larg3=\”;\n LatG=18;\n LatM=20;\n LatS=55;\n Latitud=\”-18.349\;\n Limitaciones=\”;\n Limitaciones2=\”;\n Limitaciones3=\”;\n LonG=70;\n LonS=19;\n Longitud=\”-70.339\;\n Nombre=CHACALULTA;\n OPINUMERSTAS=1;\n Pista1=\”\n-20;\n Pista3=\“\”;\n RegionOrd=15;\n Superficie=\“Hormig\\U00f3n\”;\n Superficie2=\“\”;\n Superficie3=\”;\n Telefono=“(58)211116\”;\n TieneMetar=1;\n Uso=“P\\U00daBLICO\”;\n frec=“\”;\n pdf=“;\n}”,
“(实体:Aerodromo;id:0x1f098d30;数据:{\n Ancho1=23;\n Ancho2=\”;\n Ancho3=\”;\n Ciudad=\“Arica\”;\n Desig=SCAE;\n Elev=328;\n Frecter=0;\n Frector=0;\n Fuel=\”;\n Fuel2=\”;\n IdAd=2;\n IndexRegion=1;\n Larg1=800;\n Larg2=\”;\n;\n LatG=18;\n LatM=30;\n LatS=36;\n Latitud=\“-18.51\”;\n Limitaciones=\“\”;\n Limitaciones2=\“\”;\n Limitaciones3=\“\”;\n LonG=70;\n LonM=17;\n LonS=21;\n Longitud=\“-70.289\”;\n Nombre=\\“El Buitre\”;\n numeriopistas=1;\n Pista1=“09-27\”;\n“Pista2=”;\n;\n RegionOrd=15;\n Superficie=Asfalto;\n Superficie2=\“\”;\n Superficie3=\“\”;\n Telefono=\“(58)201500 Anexo 31216\”;\n TieneMetar=0;\n Uso=MILITAR;\n frec=\“\”;\n pdf=\“;\n}”,
“(实体:Aerodromo;id:0x1f0a09c0;数据:{\n Ancho1=45;\n Ancho2=\”;\n Ancho3=\”;\n Ciudad=\“Iquique\”;\n Desig=SCDA;\n Elev=\“97-157\”;\n Frecter=“VFR-IFR\”;\n Frectore=1;\n Fuel=JP1;\n Fuel2=“AVGAS 100/130\”;\n IdAd=3;\n IndexRegion=2;\n Larg1=3350;”;”;\n Larg3=\“\”;\n LatG=20;\n LatM=32;\n LatS=07;\n Latitud=\“-20.535\”;\n Limitaciones=\“\”;\n Limitaciones=2=\“;\n Limitaciones=3=\“\”;\n LonG=70;\n LonS=53;\n Longitud=\“-70.181\”;\n Nombre=“迭戈阿拉塞纳”;\n NUMEROOPISTAS=1;\n PISTAS=19\”;\n Pista2=\“\”;\n Pista3=\“\”;\n RegionOrd=1;\n Superficie=\“Hormig\\U00f3n\”;\n Superficie2=\“\”;\n Superficie3=\“\”;\n Telefono=“(57)461200\”;\n TieneMetar=1;\n Uso=\“P\\U00daBLICO\”;\n frec=\“;\n pdf=\”;\n},
“(实体:Aerodromo;id:0x1f0a09a0;数据:{\n Ancho1=20;\n Ancho2=20;\n Ancho3=\”;\n Ciudad=\“Pica\”;\n Desig=SCKP;\n Elev=12468;\n FRETORE=0;\n FRETORE=0;\n Fuel=\“No TINE\”;\n FUELE2=\”;\n IdAd=4;\n IndexRegion=2;\n Larg1=3200;\n Larg2=1034;\n Larg2=1034;””;\n LatG=20;\n LatM=44;\n LatS=08;\n Latitud=20.736;\n Limitaciones=20;\n Limitaciones2=20;\n Limitaciones3=44;\n LonG=68;\n LonM=41;\n LonS=42;\n Longitud=68.694999999999;\n Nombre=Coposa;\n numeriopistas=2;\n Pista1=17-35;\n Pista1=10-28;\n Pista3=\“\”;\n RegionOrd=1;\n Superficie=Asfalto;\n Superficie2=Tierra;\n Superficie3=\“\”;\n Telefono=\“(57)417777\”;\n TieneMetar=0;\n Uso=PRIVADO;\n frec=\“\”;\n pdf=\“\”;\n}”,
“(实体:Aerodromo;id:0x1f0907c0;数据:{\n Ancho1=30;\n Ancho2=\“\”;\n Ancho3=\“\”;\n Ciudad=\“Pozo Almonte\”;\n Desig=SCNV;\n Elev=3172;\n frecter=0;\n frectore=0;\n Fuel=\\\\\”;\n Fuel2=\“;\n IdAd=5;\n IndexRegion=2;\n Larg1=1077;\n Larg2=”;\n Larg2=“;”\“\”;\n LatG=20;\n LatM=44;\n LatS=\“05,4\”;\n Latitud=\“-20.735\”;\n Limitaciones=\”;\n Limitaciones2=\”;\n Limitaciones3=\“\”;\n LonG=69;\n LonS=37;\n LonS=\“32,6\”;\n Longitud=\“-69.626\”;\n BRE=“Nueva Victoria\”;\n NUMEROMOPISTAS=1;\n PISTAN=27=”PISTAN\“;\n Pista3=\”\”;\n RegionOrd=1;\n Superficie=Vichufita;\n Superficie2=\”;\n Superficie3=\”;\n Telefono=”“(57)413620\”;\n TieneMetar=0;\n Uso=PRIVADO;\n frec=”;\n pdf=“\”;\n}”,
“(实体:Aerodromo;id:0x1f0920e0;数据:{\n Ancho1=18;\n Ancho2=\”;\n Ancho3=\”;\n Ciudad=\“Antofagasta\”;\n Desig=SCGU;\n Elev=3347;\n Frecter=0;\n Frectore=0;\n Fuel=\“No Tiene\”;\n Fuel2=\”;\n IdAd=6
2013-07-16 12:10:18.007 Aerodromo[13922:1207] ASync Thread Code
2013-07-16 12:10:18.045 Aerodromo[13922:907] Getting back to the UI
2013-07-16 12:10:18.090 Aerodromo[13922:907] antotaciones = 351, (
"<Aerodromo: 0x1f0b0040> (entity: Aerodromo; id: 0x1f0ad580 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p1> ; data: {\n Ancho1 = 45;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Arica \";\n Desig = SCAR;\n Elev = \"123 -166\";\n FrecTerr = IFR;\n FrecTorre = 1;\n Fuel = JP1;\n Fuel2 = \"AVGAS 100/130\";\n IdAd = 1;\n IndexRegion = 1;\n Larg1 = 2170;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 18;\n LatM = 20;\n LatS = 55;\n Latitud = \"-18.349\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 70;\n LonM = 20;\n LonS = 19;\n Longitud = \"-70.339\";\n Nombre = Chacalluta;\n NumeroPistas = 1;\n Pista1 = \"02-20\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 15;\n Superficie = \"Hormig\\U00f3n\";\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(58) 211116\";\n TieneMetar = 1;\n Uso = \"P\\U00daBLICO\";\n frec = \"<relationship fault: 0x21d8e110 'frec'>\";\n pdf = \"<relationship fault: 0x21d8e460 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0470> (entity: Aerodromo; id: 0x1f098d30 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p2> ; data: {\n Ancho1 = 23;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Arica \";\n Desig = SCAE;\n Elev = 328;\n FrecTerr = 0;\n FrecTorre = 0;\n Fuel = \"No Tiene\";\n Fuel2 = \"\";\n IdAd = 2;\n IndexRegion = 1;\n Larg1 = 800;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 18;\n LatM = 30;\n LatS = 36;\n Latitud = \"-18.51\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 70;\n LonM = 17;\n LonS = 21;\n Longitud = \"-70.289\";\n Nombre = \"El Buitre\";\n NumeroPistas = 1;\n Pista1 = \"09-27\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 15;\n Superficie = Asfalto;\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(58) 201500 Anexo 31216\";\n TieneMetar = 0;\n Uso = MILITAR;\n frec = \"<relationship fault: 0x21e711e0 'frec'>\";\n pdf = \"<relationship fault: 0x21e715e0 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0870> (entity: Aerodromo; id: 0x1f0a09c0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p3> ; data: {\n Ancho1 = 45;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Iquique \";\n Desig = SCDA;\n Elev = \"97-157\";\n FrecTerr = \"VFR - IFR\";\n FrecTorre = 1;\n Fuel = JP1;\n Fuel2 = \"AVGAS 100/130\";\n IdAd = 3;\n IndexRegion = 2;\n Larg1 = 3350;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 20;\n LatM = 32;\n LatS = 07;\n Latitud = \"-20.535\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 70;\n LonM = 10;\n LonS = 53;\n Longitud = \"-70.181\";\n Nombre = \"Diego Aracena\";\n NumeroPistas = 1;\n Pista1 = \"19-01\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 1;\n Superficie = \"Hormig\\U00f3n\";\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(57)461200\";\n TieneMetar = 1;\n Uso = \"P\\U00daBLICO\";\n frec = \"<relationship fault: 0x21e71d00 'frec'>\";\n pdf = \"<relationship fault: 0x21e71e70 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0670> (entity: Aerodromo; id: 0x1f0a09a0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p4> ; data: {\n Ancho1 = 20;\n Ancho2 = 20;\n Ancho3 = \"\";\n Ciudad = \"Pica \";\n Desig = SCKP;\n Elev = 12468;\n FrecTerr = 0;\n FrecTorre = 0;\n Fuel = \"No Tiene\";\n Fuel2 = \"\";\n IdAd = 4;\n IndexRegion = 2;\n Larg1 = 3200;\n Larg2 = 1034;\n Larg3 = \"\";\n LatG = 20;\n LatM = 44;\n LatS = 08;\n Latitud = \"-20.736\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 68;\n LonM = 41;\n LonS = 42;\n Longitud = \"-68.69499999999999\";\n Nombre = Coposa;\n NumeroPistas = 2;\n Pista1 = \"17-35\";\n Pista2 = \"10-28\";\n Pista3 = \"\";\n RegionOrd = 1;\n Superficie = Asfalto;\n Superficie2 = Tierra;\n Superficie3 = \"\";\n Telefono = \"(57)417777\";\n TieneMetar = 0;\n Uso = PRIVADO;\n frec = \"<relationship fault: 0x21e72b80 'frec'>\";\n pdf = \"<relationship fault: 0x21e72f70 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0a50> (entity: Aerodromo; id: 0x1f0907c0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p5> ; data: {\n Ancho1 = 30;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Pozo Almonte\";\n Desig = SCNV;\n Elev = 3172;\n FrecTerr = 0;\n FrecTorre = 0;\n Fuel = \"No Tiene\";\n Fuel2 = \"\";\n IdAd = 5;\n IndexRegion = 2;\n Larg1 = 1077;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 20;\n LatM = 44;\n LatS = \"05,4\";\n Latitud = \"-20.735\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 69;\n LonM = 37;\n LonS = \"32,6\";\n Longitud = \"-69.626\";\n Nombre = \"Nueva Victoria\";\n NumeroPistas = 1;\n Pista1 = \"09-27\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 1;\n Superficie = Vichufita;\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(57) 413620\";\n TieneMetar = 0;\n Uso = PRIVADO;\n frec = \"<relationship fault: 0x21e739e0 'frec'>\";\n pdf = \"<relationship fault: 0x21e73800 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b0c20> (entity: Aerodromo; id: 0x1f0920e0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p6> ; data: {\n Ancho1 = 18;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Antofagasta \";\n Desig = SCGU;\n Elev = 3347;\n FrecTerr = 0;\n FrecTorre = 0;\n Fuel = \"No Tiene\";\n Fuel2 = \"\";\n IdAd = 6;\n IndexRegion = 3;\n Larg1 = 1200;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 24;\n LatM = 8;\n LatS = 11;\n Latitud = \"-24.136\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 69;\n LonM = 49;\n LonS = 43;\n Longitud = \"-69.82899999999999\";\n Nombre = \"Aguas Blancas\";\n NumeroPistas = 1;\n Pista1 = \"13-31\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 2;\n Superficie = Tierra;\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(2) 2063737\";\n TieneMetar = 0;\n Uso = PRIVADO;\n frec = \"<relationship fault: 0x21e744d0 'frec'>\";\n pdf = \"<relationship fault: 0x21e74920 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b1020> (entity: Aerodromo; id: 0x1f0a1970 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p7> ; data: {\n Ancho1 = 50;\n Ancho2 = \"\";\n Ancho3 = \"\";\n Ciudad = \"Antofagasta \";\n Desig = SCFA;\n Elev = \"352- 455\";\n FrecTerr = \"VFR - IFR\";\n FrecTorre = 1;\n Fuel = JP1;\n Fuel2 = \"AVGAS 100/130\";\n IdAd = 7;\n IndexRegion = 3;\n Larg1 = 2599;\n Larg2 = \"\";\n Larg3 = \"\";\n LatG = 23;\n LatM = 26;\n LatS = 40;\n Latitud = \"-23.444\";\n Limitaciones = \"\";\n Limitaciones2 = \"\";\n Limitaciones3 = \"\";\n LonG = 70;\n LonM = 26;\n LonS = 42;\n Longitud = \"-70.44499999999999\";\n Nombre = \"Cerro Moreno\";\n NumeroPistas = 1;\n Pista1 = \"01-19\";\n Pista2 = \"\";\n Pista3 = \"\";\n RegionOrd = 2;\n Superficie = Asfalto;\n Superficie2 = \"\";\n Superficie3 = \"\";\n Telefono = \"(55) 269077\";\n TieneMetar = 1;\n Uso = \"P\\U00daBLICO\";\n frec = \"<relationship fault: 0x21e75370 'frec'>\";\n pdf = \"<relationship fault: 0x21e75190 'pdf'>\";\n})",
"<Aerodromo: 0x1f0b1770> (entity: Aerodromo; id: 0x1f0a41c0 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p8> ; data: <fault>)",
"<Aerodromo: 0x1f0b1f00> (entity: Aerodromo; id: 0x1f0ad660 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p9> ; data: <fault>)",
"<Aerodromo: 0x1f0b11e0> (entity: Aerodromo; id: 0x1f071c50 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p10> ; data: <fault>)",
"<Aerodromo: 0x1f0b1b50> (entity: Aerodromo; id: 0x1f0a4930 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p11> ; data: <fault>)",
"<Aerodromo: 0x1f0b13c0> (entity: Aerodromo; id: 0x1f0a3190 <x-coredata://DEC0D4FE-F4A8-4739-9974-076071695E99/Aerodromo/p12> ; data: <fault>)",
-(void)viewDidLoad {
//Do UI stuff here:
//the mapView setup
//Region set
//and any other UI like: UILabels, UIbuttons etc.
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
//So now we start the async part:
dispatch_async(queue, ^{
//Anything that is not part of the UI
//Get your data for the annotations
//And now get back to the main_queue sync:
dispatch_sync(dispatch_get_main_queue(), ^{
locations = foundObjects; //As in your code
//Update the UI
NSLog(@"Getting back to the UI");
if (locations != nil) {
[self.mapView removeAnnotations:self.mapView.annotations]; //mapView.annotations to remove all...
[self.mapView addAnnotations:locations];
}
});
});
NSLog(@"End of viewDidLoad");
}
NSMutableArray *tempLocations = [[NSMutableArray alloc] init];
//Do your fetchRequest
//Then do the following, however I don't know exactly as what your `locations` are stored so you might need to change it a bit:
//I believe your annotations are kind of a Aerodromo class? So then:
for (Aerodromo *aerodromoAnn in fetchedObjects) {
[tempLocations addObject:aerodromoAnn];
}
/
//Then update your original locations array:
locations = tempLocations.copy;
//update the main queue again