Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Input.location.start always times out

$
0
0
I followed http://docs.unity3d.com/ScriptReference/LocationService.Start.html 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(); }

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>