我从 Objective-C 编程开始,现在我可以获取一个 GPS 位置并将其发送到我的服务器。这是我的代码:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
[manager stopUpdatingLocation];
if(newLocation != nil){
float lat = newLocation.coordinate.latitude ;
float longt = newLocation.coordinate.longitude ;
uint8_t location[BUFFER_SIZE] ={0};
sprintf((char *)location, "(%f,%f)",lat , long) ;
[self writeToServer:location size:strlen((char *)location)] ;
}
}
当“writeToServer”负责发送数据时。
现在,如何更改此方法以获取两个位置,间隔 10 秒,然后发送这两个位置?
非常感谢!