私は Objective-C プログラミングから始めましたが、今では 1 つの 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 秒間隔で 2 つの場所を取得し、これら 2 つの場所を送信するにはどうすればよいでしょうか?
ありがとうございました!