2013-10-23 21 views
5

Trong ứng dụng IOS của tôi, tôi đã tuyên bố Bản đồ chứa bộ điều khiển xem dưới dạng phiên bản dùng chung.Thỉnh thoảng ios MKMapView Sự cố khi chuyển sang màn hình khác và trở lại MapScreen

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 

Tôi không sử dụng VKMapCanvas Khung nhưng tôi đang sử dụng khuôn khổ Mapkit, khi chúng tôi tiếp tục di chuyển và chuyển đổi giữa các bộ điều khiển xem nó là crashing.For mỗi 25 mét tôi thêm và loại bỏ các chú thích, tôi đã tìm kiếm trong stackoverflow một người nào đó chỉ ra đâm vì chú thích xử lý.Tôi không thể hiểu được liệu chúng tôi đang nhận được vụ tai nạn vì điều này.

-(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]; 
    }]; 
} 

và sử dụng dưới điều cho 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

Vui lòng thêm mã cho các chức năng: [VKMapCanvas animateToMapRegion: sân: yaw: Thời gian: Dự kiến ​​hoàn thành] – Meet

+0

tôi không sử dụng VKMapCanvas Khung nhưng tôi đang sử dụng khuôn khổ Mapkit, khi chúng tôi tiếp tục di chuyển và chuyển đổi giữa các quan điểm điều khiển nó đang bị hỏng.Đối với mỗi 25 mét tôi đang thêm và xóa các chú thích. –

Trả lời

0

Dường như VKMapCanvas mất ủy khi nó cố gắng để gọi [VKMapCanvas animateToMapRegion:pitch:yaw:duration:completion:], Check for Responder trước khi gọi các đại biểu phương pháp hoặc NULL giá trị.

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

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

} 
Các vấn đề liên quan