0

Lets say I have everything turned on, WIFI, GPS and CELL. However, I'm inside a subway where everyone of these are blocked.

If I do a startUpdatingLocation, would there be a time out message? And where would it come from?

(Note: I believe it will send me a previous known location, but what if it is my first time turning everything on?)

mskw
  • 10,063
  • 9
  • 42
  • 64
  • 3
    Have you read the documentation [`CLLocationManagerDelegate`](https://developer.apple.com/library/iOS/#documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html#//apple_ref/occ/intf/CLLocationManagerDelegate), it clearly state [`– locationManager:didFailWithError:`](https://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html#//apple_ref/occ/intfm/CLLocationManagerDelegate/locationManager:didFailWithError:). – rckoenes Apr 10 '13 at 15:24
  • I've read it, but I just want to make sure I'm not mistaken as I have no means of testing this quickly. – mskw Apr 10 '13 at 15:36
  • You can test it easily using a [Faraday cage](http://stackoverflow.com/a/13831212/1693173) to block the signals. – progrmr Apr 10 '13 at 17:19

1 Answers1

1

When you first send startUpdatingLocation your delegate will get a callback with the cached location. You can tell its a cached location because of its age. Then once it gets a fix from Cell, WiFI, and/or GPS you will get additional updates. If it never gets a fix you'll get the didFailWithError: message back after a few minutes. However, I think once you've gotten at least one fix you won't get the error if you later lose GPS/WiFi/Cell signals by going into the subway.

Community
  • 1
  • 1
progrmr
  • 75,956
  • 16
  • 112
  • 147
  • Ok, what happens if they don't have a cached location? I guess it goes straight to didFailWithError. – mskw Apr 10 '13 at 19:26
  • I think it will try to get a signal for a few minutes before it goes to didFailWithError: I'm not certain it will report an error if the only problem is lack of signal, it may just keep trying. You may want to set a timer if you want to be sure to handle this case. – progrmr Apr 10 '13 at 21:34