我有一个应用程序,它使用顶部栏导航和一个MapView。在地图视图中,我放置了一些注释,并在选择注释时,按下披露按钮进入子视图,然后使用后退按钮返回到MapView,我的应用程序崩溃。它不会给我任何错误。导航和MapKit使应用程序崩溃
任何人都可以帮我找出为什么我的应用程序不断崩溃?
我做了一个简短的视频显示这个神秘的崩溃(因为我害怕,我不解释得很好)
视频可以在此链接上可以看到http://snuzzer.dk/pub/iPhoneAppMapKitCrash.mov
请告诉我,如果您需要查看任何代码才能确定崩溃的原因。我不确定哪些代码是必要的,因为我没有得到任何错误。
编辑:这是我的堆栈跟踪的输出:
#0 0x01275a63 in objc_msgSend
#1 0x0586c860 in ??
#2 0x0037ef1d in -[UINavigationController setDisappearingViewController:]
#3 0x0037c4f6 in -[UINavigationController _clearLastOperation]
#4 0x0037ce3f in -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
#5 0x00509e23 in -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:]
#6 0x0050afd2 in -[UINavigationTransitionView _cleanupTransition]
#7 0x002f6665 in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
#8 0x002f64f7 in -[UIViewAnimationState animationDidStop:finished:]
#9 0x01ffa6cb in run_animation_callbacks
#10 0x01ffa589 in CA::timer_callback
#11 0x010f4fe3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#12 0x010f6594 in __CFRunLoopDoTimer
#13 0x01052cc9 in __CFRunLoopRun
#14 0x01052240 in CFRunLoopRunSpecific
#15 0x01052161 in CFRunLoopRunInMode
#16 0x01a48268 in GSEventRunModal
#17 0x01a4832d in GSEventRun
#18 0x002d442e in UIApplicationMain
#19 0x00002918 in main at main.m:14
编辑:看来,当我不释放我的annotationViewController应用程序不会崩溃。我会继续玩这个应用程序,看看这是否正确。任何人都可以告诉我这是否正确,如果是这样,为什么?那我什么时候可以发布它呢?
- (void)mapView:(MKMapView *)aMapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
for(MyAnnotation* a in mapView.annotations) { // searching for chosen annotation
if(view.annotation == a) {
// set array from plist
NSString *path = [[NSBundle mainBundle] pathForResource:@"Annotations" ofType:@"plist"];
NSMutableArray* anns = [[NSMutableArray alloc] initWithContentsOfFile:path];
AnnotationDetailViewController *annotationDetailViewController = [[AnnotationDetailViewController alloc] initWithNibName:@"AnnotationDetailViewController" bundle:nil];
annotationDetailViewController.ann = [anns objectAtIndex:[a.annId intValue]];
[self.navigationController pushViewController:annotationDetailViewController animated:YES];
[annotationDetailViewController release]; // this is the one that I think will correct the error
[anns release];
}
}
}
你应该从崩溃时检查堆栈跟踪开始,并发布如果它没有解释问题。 – 2011-02-12 20:44:27