データベースに 4 つの値を保存したいと思います。経度、緯度の電話番号とタイムスタンプ。
NSLOGを使用してローカルに保存する方法を理解しました。
しかし、それをMySQLデータベースに送信したい.
誰かがチュートリアルを持っているか、ここで私を助けたいですか?
私はこれがひどく必要です、
あなたの助けをいただければ幸いです。
あいさつ
アップデート
データベースに保存する必要があるコードは次のとおりです
resultsLabel.text = [NSString stringWithFormat:@"(%@) %@ Location %.06f %.06f %@", ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) ? @"bg" : @"fg", resultsLabel.tag == 0 ? @"gps:" : @"sig" , newLocation.coordinate.latitude, newLocation.coordinate.longitude, [formatter stringFromDate:newLocation.timestamp]];
LocationTestAppDelegate * appDelegate = (LocationTestAppDelegate *)[UIApplication sharedApplication].delegate;
[appDelegate log:resultsLabel.text];
NSString* encodedValue = [newLocation.coordinate.latitude
stringByAddingPercentEscapesUsingEncoding:
NSASCIIStringEncoding];
//construct an URL for your script, containing the encoded text for parameter value
NSURL* url = [NSURL urlWithString:
[NSString stringWithFormat:
@"http://yourdomain.com/locatie.php?id=%@",
encodedValue]];
NSError* error = nil;
//send the request synchronously, store the response in result
NSString* result = [NSString stringWithContentsOfURL:url
encoding:NSUTF8StringEncoding
error:&error];
if (!error && ([result isEqualToString:@"OK"])) {
// everything went well
}
そして、テキストフィールド、経度、緯度、タイムスタンプから電話番号を保存する必要があります。
ごあいさつ(改めて)