Input.location.start always times out

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();
	}

As stated in this thread by pavel_stupka, here it is a workaround for this problem. It was useful for me.

After generating the project with Unity. open it with XCode and:

  * Find -> Find in Project
  * Search for: startUpdatingLocation
  * It should find 2 source files:  "iPhone_Sensors.h" and  "iPhone_Sensors.mm" 
  * Open "iPhone_Sensors.h" and add:
 
     #define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
 
  * Open iPhone_Sensors.mm and before the line:
 
     [locationManager startUpdatingLocation];
 
     Add the following code:
 
     if(IS_OS_8_OR_LATER) {
        [locationManager requestAlwaysAuthorization];
     }
     
  * At the end add "NSLocationAlwaysUsageDescription" to your Info.plist as a string with your customized message.