I\'m developing the iOS app and in one of the views I would like to include UIWebView with a page that contains a map (the address is: https://carsharing.mvg-mobil.de). The
OK, I found the solution in the source code of PhoneGap how to inject JavaScript code to a standrad webview with the location fetched from CoreLocation:
int epoch = [newLocation.timestamp timeIntervalSince1970];
float course = -1.0f;
float speed = -1.0f;
NSString* coords = [NSString stringWithFormat:@"coords: { latitude: %f, longitude: %f, altitude: %f, heading: %f, speed: %f, accuracy: %f, altitudeAccuracy: %f }",
newLocation.coordinate.latitude,
newLocation.coordinate.longitude,
newLocation.altitude,
course,
speed,
newLocation.horizontalAccuracy,
newLocation.verticalAccuracy
];
NSString * jsCallBack = [NSString stringWithFormat:@"navigator.geolocation.setLocation({ timestamp: %d, %@ });", epoch, coords];
[webView stringByEvaluatingJavaScriptFromString:jsCallBack];
Hopefully somebody else can profit from this code as well.