繁体   English   中英

iOS模拟器和XCode模拟指南针?

[英]iOS simulator and XCode to simulate Compass?

我知道现在有一种模拟位置的方法,但有没有办法模拟罗盘值?

Compass不在模拟器支持的硬件交互列表中,并且CLLocationManager headingAvailable报告它在模拟器上不可用。

另外,在这个文档中:

http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html

某些位置服务需要在给定设备上存在特定硬件。 例如,标题信息仅适用于包含硬件指南针的设备。 此类定义了几种可用于确定当前可用服务的方法。

具体来说,CLLocationManager具有此类属性来检查指南针是否可用:

+ (BOOL)headingAvailable

如果我在模拟器下运行:

NSLog(@"headingAvailable: %d", (int)[CLLocationManager headingAvailable]);

输出:

2011-11-08 22:38:26.873 Craplet[39975:b603] headingAvailable: 0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM