June 14, 2010
Posted by on
While working and debugging my XCode project that involves reading of Users’ Current Location (GPS), I just noticed that when I run the application on to my Device (iPhone 3GS 3.1.2), it didn’t ask for permission to Allow Current Location. and I thought I was doing something wrong with my code. So I looked back and tried running it on iPhone Simulator, the code works and it did catch the defaulted Current Location on the Simulator. Then I restarted my device to make sure everything is on the init state. I opened the Compass application, and it read 0 degress N and the Locate button on the lower left is disabled!
With this encounter on my device, I started other applications installed on my phone that accesses my GPS and none of them worked! Naturally, I suspected that my iPhones’ GPS suddenly died on me. Through this, I started firing up Firefox and start googling looking for someone who has the same case bout me and a solution for the problem.
Solution #1: Resetting Network Settings
It said that by resetting the Network Settings on my iPhone will fix the issue. So I reset my settings through Settings/General/Reset/Reset Network Settings and my device restarted itself.
This solution didn’t worked for me but it did work on most iPhone 3G models.
I keep on searching and found the most reliable solution that involves opening an SSH on my device. So, I’m sharing what I did below:
Solution #2: Issuing commands on SSH Terminal
This solution will only work on a Jailbroken iPhone as it needs to be able to connect via SSH.
1. Connect to SSH by using Putty on Windows.
2. Login as root (default password is alpine)
3. Type killall –9 locationd and press Enter. This will signal to kill a process called locationd (the daemon that GPS use).
4. Type rm -rf /var/root/Library/Caches/locationd .This will remove all available cache under the locationd directory which in this case is the cache.plist. You can also delete just the cache.plist if you like.
5. Open up Compass application again the the alert popup will display asking for a permission to use your Current Location.
Solution #2 accurately fixed my GPS issue and I didn’t even need to restore my iPhone from my backup! This approach saved my day and I recommend doing the same thing if the problem will occur on your precious iPhone 3GS.