我想接收用户当前位置的坐标,我输入了以下代码:
-(void)update{
locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.delegate = self;
mapView.showsUserLocation = YES;
[locationManager startUpdatingLocation];
}
在 iOS Simulator 上,此代码正在崩溃,而在我的设备上却没有,或者有时它会导致整个应用程序崩溃......你能帮我看看发生了什么吗?