IOS8解决获取位置坐标信息出错(Error Domain=kCLErrorDomain Code=0)

时间:2023-03-10 00:06:00
IOS8解决获取位置坐标信息出错(Error Domain=kCLErrorDomain Code=0)

最近在模拟器上调试发现获取位置坐标信息的时候会报错,错误信息: didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLErrorDomain error 0.)”。

出错原因是xcode里面的project-->scheme-->edit scheme-->options-->core location-->allow location simulation配置错误;如下图:

IOS8解决获取位置坐标信息出错(Error Domain=kCLErrorDomain Code=0)

解决办法:

1. 若已经设置了,取消勾选,保存;

2. 将simulator-->reset content and settings:

3. 再重新勾选allow location simulation,

4. 再reset content and settings

这样应该就可以解决该问题了。