问题是当我将互联网从wifi连接到3G时,位置没有更新,并且从未调用过更新到位置。任何人都可以帮助我吗?我必须在每5秒后通过网络服务向服务器发送更新的当前位置。网络服务正在呼叫,但每次相同的坐标都转到服务器。我想发送更新位置的坐标但是在3G上,位置更新方法从未调用过改变位置
[mapview animateToLocation:newLocation.coordinate];
Currentmarkers.position = CLLocationCoordinate2DMake(newLocation.coordinate.latitude,newLocation.coordinate.longitude);
deleg.currentCoordinates = [[CLLocation alloc]initWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.longitude];
以下是我用来创建位置管理器的代码:
currentLocation = [[CLLocationManager alloc]init];
currentLocation.distanceFilter = kCLDistanceFilterNone;
currentLocation.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
currentLocation.delegate = self;
[currentLocation startUpdatingLocation];
答案 0 :(得分:0)
从WiFi切换到3G不应该与它有任何关系。
您需要发布创建位置管理器的代码,配置它,将您设置为委托,以及您的位置管理器委托方法。如果你有所需的精度或者distanceFilter值设置得足够高,你就不会得到通知,直到你移动很远的距离。
尝试将准确度设置为" best"值和距离过滤器值到kCLDistanceFilterNone进行测试。
您可能还需要在界面中添加滚动文本视图,记录位置更新,然后带上您的设备并走一公里左右。然后你应该移动var足以确保获得位置更新。