iphone - iOS模拟器和XCode来模拟Compass?

标签 iphone objective-c ios xcode core-location

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

最佳答案

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

此外,在本文档中:

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

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/

相关文章:

iphone - NSURLConnection 下载委托(delegate)方法未被调用

ios - 神奇记录自定义核心数据迁移不拉现有数据

iphone - 加载不同的 subview

ios - UIKit Dynamics 的性能问题

iphone - 简单的 UITapGestureRecognizer。 IBAction 未触发

iphone - 如果一个 UIButton alpha 设置为 0,不需要 removeFromSuperview 吗?

iphone - 用户可以禁用 LocalNotifications

objective-c - 如何将窗框 roundTextured 边框样式应用于不在窗框内的 NSButton?

ios - CGAffine 使用 UIPanGestureRecognizer 转换 UIView

ios - 如何隐藏 AVPlayerViewController 控制栏?