我知道现在有一种模拟位置的方法,但是有没有一种方法可以模拟罗盘值?。
最佳答案
Compass 不在模拟器支持的硬件交互列表中,CLLocationManager headingAvailable 报告它在模拟器上不可用。
此外,在本文档中:
Some location services require the presence of specific hardware on the given device. For example, heading information is available only for devices that contain a hardware compass. This class defines several methods that you can use to determine which services are currently available.
特别是 CLLocationManager 有这个类属性来检查指南针是否可用:
+ (BOOL)headingAvailable
如果我在模拟器下运行:
NSLog(@"headingAvailable: %d", (int)[CLLocationManager headingAvailable]);
输出:
2011-11-08 22:38:26.873 Craplet[39975:b603] headingAvailable: 0
关于iphone - iOS模拟器和XCode来模拟Compass?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8059725/