Error: Could not find location:


#1

I have a strange error, I built the application on my Mac Pro and everything seems to function as described, I get prompted if I want to use my current location, say yes, but in the debugger console window, I get the following error:

[Session started at 2011-02-11 22:46:06 -0500.]
2011-02-11 22:46:53.835 Whereami[1249:207] Could not find location: Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
2011-02-11 22:47:40.828 Whereami[1249:207] Could not find location: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLErrorDomain error 0.)”

I checked for any any typos, can find none. So, I tried running this on my Macbook Pro and it works exactly as described.

Any assistance would be greatly appreciated.


#2

SOLUTION: Turn AirPort on. You do not need to connect to a wireless network.

I receive the same error that you report while running the app in the simulator on my iMac with a hardwired ethernet connection and AirPort off. The app works fine when I simply turn AirPort on without connecting to a wireless network. Hope that this solves your problem.


#3

I’m having this same problem but I can’t fix it.

I can’t turn on airport. I don’t have an airport card (removed awhile ago while upgrading, got rid of it since I had no wifi network and no conceivable need for it).

Airport utility won’t start without an airport device attached. I’ve even ordered a mac compatible USB network adapter and that won’t let the airport utility start either.

I was able to get it to run before the mapview addition by using some location simulator code I found online. But when I added in mapview, it just defaults to somewhere in the indian ocean and doesn’t even prompt me to allow it to ask for location. Taking out the simulator code doesn’t change anything. It just refuses to work.

There has to be some way around this. If I can’t get through this part, how can I finish up with the rest of the book when other parts build on this code?

I have to add that Apple requiring airport be started in order to do nothing but return a static location in cupertino to the iphone simulator is one of the dumbest programming decisions I’ve ever seen.


#4

Hello,

I am getting this same error. I am trying to run the example in Chapter 4 of Big Nerd Ranch’s iPhone Programming book and continue to get this error in the simulator as well. I am running XCode 3.2.5. My airport is turned on and I have tried while connected to my wireless network and while I am not connected to my wireless network. The simulator is running on my iMac. I do not have an ethernet port hard wired.

All other forums I have read say it is connected to the Airport being set ON, but this is not solving the issue.

Anyone have any ideas?


#5

The CLLocationManager needs to be able to get to a server to find the location, no way around that one. Sorry.


#6

I have hit this problem too. Strangely the app in chapter 5 works just fine, so there’s no problem with the simulator not finding a wi-fi connection to use.

Being a newbie I can’t see how to debug what the CLLocationManager is doing, any ideas as to what I could do to trace where the problem might lie?

Thanks

btw I’m using Xcode 4.0.1 and iOS 4.3 - and the learning curve is proving to be near vertical!


#7

I’ve also seen this issue. Let me go through what i did so to be clear.

1 - Performed all steps in chapter 4 but not completed the “Challenge Heading” yet. => Everything was good and i could see the output in the console.
2 - Built and Ran the code again but accidentally clicked “the tick box (dont ask me again)” & “not allow location services”.
3 - After the above i got the error messages “Could not find location”, even though the airpot was on and enabled and working as expected.

To resolve this i did the following (After searching on the web for ages):

Open:
1 - System Preferences > Security > (Button) “Reset Warnings”.
2 - Goto Simulator menu (when its running) and “reset contents and settings”.
3 - Goto Xcode menu and “Clear cache”.
4 - Empty Trash and re-run the code.

Hopefully that helps.

p.s. To the last post, the learning curve is definitely straight up.


#8

I am having the exact error.

  • Airport is on, in fact I’m connected wirelessly right now.
  • My code compiles and runs.
  • I’ve inspected my code multiple times for consistency with the book.
  • I’ve taken all the steps suggested in Makato76’s post.
  • Using XCode 3.2.6 (for consistency with the book) and latest IOS library.
  • Working on an MBP with 8GB ram
  • VMWare Fusion is running Windows also (could that be causing a problem?)

Any suggestions?

Thx


#9

de


#10

I am getting the same problem.
I have not yet completed the purchase of full Developer Progrm($99).
I am using xcode 4.0.2. - Working on a Mac OSX 10.6.7 - (airport)
I can compile and run, I get the popup ask if I allow location services, I say YES.
The simulator opens and my console prints out:
2011-06-19 23:25:39.625 Whereami[36246:207] Could not find location: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLErrorDomain error 0.)”

Should this grab my location if I’m only in simulator/console?

Jerry


#11

I have to question the wisdom of building 2-3 chapters of a learning book around a project that uses aspects not all people can use.

:confused:

I could try and skip these chapters but I have a feeling thats going to be bad.

Is there any workaround us beginners can use? Like slap in a fake return value or something. Simulate the sumulator, if you will ;p


#12

I ran into the same issue. I am running xcode 4.02 and using the simulator. I know that 4.x is pickier about explicit declarations of protocols in the @interface directive. I noticed a warning that the protocol CLLocationManagerDelegate wasn’t implemented (“Class ‘WhereamiAppDelegate’ does not implement the ‘CLLocationManagerDelegate’ protocol”) . Once I included the protocol (@interface WhereamiAppDelegate : NSObject <UIApplicationDelegate, CLLocationManagerDelegate>), it successfully reported the location when the app was launched. However, about every 30 seconds or so afterwards, it reports the error. Is that normal? I’m thinking maybe since the location isn’t changing, the method

(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

doesn’t get subsequently called. Maybe then there is a timeout if a new location isn’t reported withing a certain time period and the error method is called. Any ideas?