2013-10-23 3 views
5

In meiner IOS App habe ich Map contained view controller als gemeinsame Instanz deklariert.Gelegentlich stürzt ios MKMapView ab, wenn Sie zu einem anderen Bildschirm gehen und zum MapScreen zurückkehren

Exception Type: EXC_BAD_ACCESS (SIG SEGV) 
Exception Codes: KERN_INVALID_ADDRESS at 0x00000028 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 

Thread 0 Crashed: 

0 VectorKit      0x37058b86 __64-[VKMapCanvas 
animateToMapRegion:pitch:yaw:duration:completion:]_block_invoke_0168 + 50 

1 VectorKit      0x37003bee -[VKAnimation _stopAnimation:] + 38 

2 VectorKit      0x36fcd4a8 -[VKAnimation onTimerFired:] + 48 

3 VectorKit      0x36fcd2d0 -[VKMainLoop displayTimerFired:] + 352 

4 QuartzCore      0x3ab6706c 

CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156 

5 QuartzCore     0x3ab66fc4 CA::Display::IOMFBDisplayLink::callback(__ IOMobile Frame buffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 
60 
6 IO Mobile Frame buffer    0x34609fd4 IO Mobile Frame buffer VsyncNotify Func + 152 

7 IOKit       0x3b2f7446 IODispatchCalloutFromCFMessage + 190 

8 CoreFoundation     0x33d1d5d8 __CFMachPortPerform + 116 

9 CoreFoundation     0x33d28170 

__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32 

10 CoreFoundation     0x33d28112 __CFRunLoopDoSource1 + 134 

11 CoreFoundation     0x33d26f94 __CFRunLoopRun + 1380 

12 CoreFoundation     0x33c99eb8 CFRunLoopRunSpecific + 352 

13 CoreFoundation     0x33c99d44 CFRunLoopRunInMode + 100 

14 GraphicsServices    0x3ba972e6 GSEventRunModal + 70 

15 UIKit       0x3b5552f4 UIApplicationMain + 1116 

16 DNA        0x000dd860 main (main.m:17) 

17 DNA        0x000dd3dc start + 36 

ich nicht VKMapCanvas Rahmen verwende, aber ich bin mit MapKit Rahmen, wenn wir in Bewegung bleiben und das Umschalten zwischen View-Controller ist crashing.For alle 25 Meter Ich füge und die Anmerkungen zu entfernen, suchte ich in stackoverflow jemand wies darauf hin, wegen Annotationsbehandlung abstürzen. Ich bin nicht in der Lage zu verstehen, ob wir deswegen abstürzen.

-(void)getFieldTips:(id)response {                      
    if([response objectForKey:@"No Net"]){ 

    } 
    else{ 

     [self removeTipAnnotations]; 
     [fieldTipsMArray removeAllObjects]; 
     fieldTipsMArray = [response objectForKey:@"data"]; 
     if ([fieldTipsMArray count]) { 

      [self addFieldtipsToRoute:fieldTipsMArray]; 

     } 
    } 
} 

- (void)removeTipAnnotations { 

    NSMutableArray *locs = [[NSMutableArray alloc] init]; 

    for (id <MKAnnotation> annot in [self.theMapView annotations]) 
    { 
     if ([annot isKindOfClass:[ MKUserLocation class]]) { 

     } 
     else if([annot.title isEqualToString:@"tip"]) { 
      [locs addObject:annot]; 
     } 

    } 

    [self.theMapView removeAnnotations:locs]; 
    locs = nil; 
} 

- (void)addFieldtipsToRoute: (NSMutableArray *)fieldTipsMutableArray{ 

    [fieldTipsMutableArray enumerateObjectsUsingBlock:^(id fieldTipsObjectFromService, NSUInteger fieldTipsIndex, BOOL *stop) { 

     fieldTipsObjectFromService = [fieldTipsMArray objectAtIndex:fieldTipsIndex]; 
     Annotation *ann = [[Annotation alloc] initWithLatitude:[[fieldTipsObjectFromService objectForKey:@"lat"] doubleValue] Longitude:[[fieldTipsObjectFromService objectForKey:@"lon"] doubleValue]]; 
     ann.title = @"tip"; 
     ann.tagForAnnotation = fieldTipsIndex; 
     [self.theMapView addAnnotation:ann]; 
    }]; 
} 

und unterhalb Dinge verwenden für UserTracking

[self.theMapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES]; 


- (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated 
{ 

    dispatch_async(dispatch_get_main_queue(),^{ 
     if ([CLLocationManager locationServicesEnabled]) { 
      if ([CLLocationManager headingAvailable]) { 
       [self.theMapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:NO]; 
      }else{ 
       [self.theMapView setUserTrackingMode:MKUserTrackingModeFollow animated:NO]; 
      } 
     }else{ 
      [self.theMapView setUserTrackingMode:MKUserTrackingModeNone animated:NO]; 
     } 
    }); 

} 
+0

Bitte fügen Sie Code für die Funktion: [VKMapCanvas animateToMapRegion: pitch: Gieren: Dauer: Abschluss:] – Meet

+0

ich verwende nicht VKMapCanvas-Framework, aber ich bin mit MapKit Rahmen, wenn wir in Bewegung bleiben und das Umschalten zwischen Ansicht-Controller es stürzt ab. Für alle 25 Meter füge ich hinzu und entferne die Anmerkungen. –

Antwort

0

Es scheint, dass VKMapCanvas verliert delegieren, wenn es für Responder aufzurufen versucht [VKMapCanvas animateToMapRegion:pitch:yaw:duration:completion:], zu prüfen, bevor die Methode delegieren oder NULL Werte aufrufen.

 
if ([delegate respondsToSelector:@Selector(animateToMapRegion:pitch:yaw:duration:completion:)]) 
{ 

    [delegate animateToMapRegion:pitch:yaw:duration:completion:];//Call your method 

} 
Verwandte Themen