Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

ios - CLLocationManager on iPhone Simulator fails with kCLErrorDomain Code=0

CLLocationManager on iPhone Simulator is supposed to fake Cupertino (isn't it?) but it does NOT, it fails with kCLErrorDomain Code=0 instead. LocationManager's delegate receives the message didFailWithError. This method is implemented to log the error and the console outputs the following:

Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"

I was working on a real project when I ran into this problem but it is pointless to discuss my code because I downloaded "Locations" sample code (updated 2010-06-22 for iOS 4) from the dev center and the problem persisted.

The app is suposed to enable an "add" button when it receives the first location update so users can track their locations but it does nothing.

I added one (trivial) line to the implementation of didFailWithError to log the errors, if any. I get the error described above.

With Xcode 3.2.2 and targeting 3.1.3, I could get a fixed location (Cupertino) when running an older version of the "Locations" project.

Can somebody help?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This error also occurs if you have Scheme/Edit Scheme/Options/Allow Location Simulation checked but don't have a default location set.

Please check this it may resolve your issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...