2012-09-11 23 views
0

我在我的应用程序中使用corelocation,它根据需要检索纬度/经度,但当我“退”出该页面([self dismissModalViewControllerAnimated:YES];)应用程序崩溃。Corelocation崩溃

我没有得到任何错误,只能假设我不能正常退出更新位置?

任何帮助?

感谢

+0

当它崩溃时它会给出什么信息? – jrtc27

+0

没有给出消息,只是崩溃。 –

+0

崩溃日志在组织者中说什么? – jrtc27

回答

0

你的问题是相当模糊的,但我估计你指的是你CLLocationManager的代表。您的页面被取消分配,位置管理器失去它的委托并且位置管理器尝试访问它的委托时应用程序崩溃。

你应该收拾妥当位置管理。

在-dealloc,在 - 可能一个UIViewController设置类似(这仅仅是一个开始):

- (void) dealloc { 
    //todo: stop updating/release the location manager too 
    [self.locationManager setDelegate:nil]; 

    //there should be a lot more code here 

    [super dealloc]; 
} 

你应该适当地管理你的对象,尤其是你的位置管理器,虽然。您应该阅读Apple的Delegates and Data Sources文档和Apple的Memory Management guide