Я использую приложение IOS с MKMapView
. Я использую контроллер навигации, чтобы перейти из главного меню в режим просмотра карты и из режима просмотра карты с помощью кнопки «Назад» снова в главное меню. Это нормально работает !. Но если я добавляю аннотации на карту и нажимаю кнопку «Назад», приложение каждый раз вылетало из строя.
В навигаторе отладки xcode есть ошибка примерно: lldb_unnamed_function1128$$CoreLocation
Также некоторая информация от Crashlytics:
0
CoreLocation
CLClientCreateIso6709Notation + 31645
1
libobjc.A.dylib
objc_object::sidetable_release(bool) + 174
2
libobjc.A.dylib
objc_object::sidetable_release(bool) + 174
3
MapKit
std::__1::__vector_base<objc_object* __strong, std::__1::allocator<objc_object* __strong> >::~__vector_base() + 28
4
MapKit
MKQuadTrieNodeFree(MKQuadTrieNode*) + 32
5
MapKit
__38-[MKQuadTrie clearAllItemsPerforming:]_block_invoke + 72
6
MapKit
_breadthFirstApply(MKQuadTrieNode*, MKQuadTrieTraversalDirective ()(MKQuadTrieNode*) block_pointer) + 186
7
MapKit
-[MKQuadTrie clearAllItemsPerforming:] + 166
Что такое lldb_unnamed_function1128$$CoreLocation
ошибка
Кто-нибудь может помочь? :)
Код моей кнопки возврата:
- (IBAction)backPressed:(id)sender {
[self.mapView removeAnnotations:self.mapView.annotations];
[self.mapView removeOverlays:self.mapView.overlays];
self.locationManager.delegate = nil;
self.mapView.delegate = nil;
NSLog(@"Done!");
}
Код viewForAnnotation:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
if (annotation == mapView.userLocation) {
return nil; // Let map view handle user location annotation
}
// Identifyer for reusing annotationviews
static NSString *annotationIdentifier = @"icon_annotation";
// Check in queue if there is an annotation view we already can use, else create a new one
IconAnnotationView *annotationView = (IconAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];
if (!annotationView) {
annotationView = [[IconAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier];
annotationView.canShowCallout = YES;
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
}
return annotationView;
}
код, который добавляет аннотации (названная кнопка перезагрузки):
- (IBAction)reload:(id)sender {
[self.mapView removeOverlays:self.mapView.overlays];
if (!userPressedReload) {
self.parkPlace1 = [[Place alloc] initWithLong:40.975301 Lat:22.069451 iconStatus:[NSNumber numberWithInt:2] beforeMin:[NSNumber numberWithInt:10]];
self.parkPlace2 = [[Place alloc] initWithLong:40.981507 Lat:22.057485 iconStatus:[NSNumber numberWithInt:1] beforeMin:[NSNumber numberWithInt:20]];
[self.mapView addAnnotation:self.parkPlace1];
[self.mapView addAnnotation:self.parkPlace2];
userPressedReload = YES;
}
self.annotations = [NSMutableArray arrayWithArray:self.mapView.annotations];
if (self.mapView.userLocation) {
[self.annotations removeObject:self.mapView.userLocation];
}
[self.mapView removeAnnotations:self.annotations];
[self.mapView addAnnotations:self.annotations];
}
CoreLocation
фреймворк? - person GoGreen   schedule 19.02.2014- (IBAction)backPressed:(id)sender
? - person GoGreen   schedule 19.02.2014[self.mapView addAnnotations:self.annotations];
- person GoGreen   schedule 19.02.2014same code
, который вы написали вbackPressed:(id)sender
, в методviewDidDisappear
. попробуй сделать это. - person GoGreen   schedule 19.02.2014[self.mapView removeAnnotations:self.mapView.annotations]; [self.mapView removeOverlays:self.mapView.overlays];
в функции нажатия кнопки возврата. это имеет значение? - person GoGreen   schedule 19.02.2014navigationController
. Вместо этого вы можете представить и отклонитьmapViewController
модально. - person GoGreen   schedule 19.02.2014