I followed Unity - Scripting API: LocationService.Start but on my phone (iOS 8) it times out. I’ve sent the maxWait and accuracy to 1000. Also, I never got the iOS location permission popup. I had to go into settings and enable it manually. Here’s my code, maybe I did something stupid.
IEnumerator GetLocation(){
if (!Input.location.isEnabledByUser){
print("LocationInfo disabled");
yield break;
}
Input.location.Start(1000, 1000);
int maxWait = 1000;
while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) {
yield return new WaitForSeconds(1);
maxWait--;
}
if (maxWait < 1) {
print("Timed out");
yield break;
}
if (Input.location.status == LocationServiceStatus.Failed) {
print("Unable to determine device location");
yield break;
}
else if (ParseUser.CurrentUser != null) {
ParseUser user = ParseUser.CurrentUser;
user["Location"] = new ParseGeoPoint(Input.location.lastData.latitude, Input.location.lastData.longitude);
user.SaveAsync();
print("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
}
Input.location.Stop();
}