Iphone 导航和地图工具包使应用程序崩溃

Iphone 导航和地图工具包使应用程序崩溃,iphone,crash,controller,navigation,mapkit,Iphone,Crash,Controller,Navigation,Mapkit,我有一个使用顶栏导航和地图视图的应用程序。在地图视图上,我放置了一些注释,当选择注释时,按“公开”按钮进入子视图,然后使用“上一步”按钮返回地图视图,我的应用程序崩溃。它没有给我任何错误 有人能帮我弄清楚为什么我的应用程序一直崩溃吗 我制作了一个短片,展示了这场神秘的坠机事件(因为我恐怕没有很好地解释) 视频可以在这个链接上看到 请告诉我您是否需要查看任何代码以确定崩溃的原因。我不确定这需要什么代码,因为我没有得到任何错误 编辑:这是我的堆栈跟踪的输出: #0 0x01275a63 in ob

我有一个使用顶栏导航和地图视图的应用程序。在地图视图上,我放置了一些注释,当选择注释时,按“公开”按钮进入子视图,然后使用“上一步”按钮返回地图视图,我的应用程序崩溃。它没有给我任何错误

有人能帮我弄清楚为什么我的应用程序一直崩溃吗

我制作了一个短片,展示了这场神秘的坠机事件(因为我恐怕没有很好地解释)

视频可以在这个链接上看到

请告诉我您是否需要查看任何代码以确定崩溃的原因。我不确定这需要什么代码,因为我没有得到任何错误

编辑:这是我的堆栈跟踪的输出:

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

您应该在
AnnotationDetailViewController
中查找您正在保留/过度释放的ivar。我会怀疑某些UIView,可能是您没有配置为保留的IBOutlet,特别是如果您在
viewDidUnload
中也未能将其设置为nil。如果你还没有读过,我建议你读一读


如果没有代码或关于变量的更多信息,很难对其进行调试,但考虑到崩溃的位置,我会在这里查看。

崩溃时,您应该首先检查stacktrace,如果它不能解释问题,则发布它。您很可能过度释放了某些对象,如果不检查代码就无法判断…我建议检查堆栈跟踪并检查崩溃的位置,就像@Rob Napier所说的,这可能是对您过度释放的对象的调用…如果您无法找到,请至少发布跟踪out@RopNapier和@Daniel,谢谢你的意见。我无法通过堆栈跟踪找出崩溃的位置和原因。只是,它似乎是在转变观念。我已经更新了原始帖子以显示堆栈跟踪。你能看一下吗?似乎当我不释放我的annotationDetailViewController(点击“公开”按钮时更改视图的ViewController)时,我无法再现错误。有人能告诉我为什么会这样吗?代码见原始帖子。