A simple location services program was working fine on my machine and suddenly stopped working. Upon further exploring the problem, I realized that some process has disabled location services in System Preferences » Security & Privacy » Privacy.
I checked Enable Location Services, but again it got disabled automatically.
After some research I found that it's not just my program, even built-in system functions are also failing because of this problem for example System Preferences » Date & Time » Time Zone failed to get the current location.
Every time I check Enable Location Services, I see the following error in the console logs:
16/10/12 11:23:15.636 AM [0x0-0x42042].com.apple.systempreferences: ERROR,Time,372059595.636,Function,"CLInternalSetLocationServicesEnabled",CLInternalSetLocationServicesEnabled failed
16/10/12 11:23:15.638 AM [0x0-0x42042].com.apple.systempreferences: STACK,Time,372059595.636,1 CoreLocation 0x00007fff8f9957be CLInternalSetLocationServicesEnabled + 110
Notes:
WiFi is on
I didn't install iOS Simulator
I use Xcode Version 4.5 (4G182)
I use Boot Camp and made my MacBook Pro dual boot (Mac OS X Lion and Windows 7)
I do only Mac development but not iOS