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

Osc*_*mez 8 iphone xcode objective-c core-location ios

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

bry*_*mac 9

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

另外,在这个文档中:

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

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

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

+ (BOOL)headingAvailable
Run Code Online (Sandbox Code Playgroud)

如果我在模拟器下运行:

NSLog(@"headingAvailable: %d", (int)[CLLocationManager headingAvailable]);
Run Code Online (Sandbox Code Playgroud)

输出:

2011-11-08 22:38:26.873 Craplet[39975:b603] headingAvailable: 0
Run Code Online (Sandbox Code Playgroud)