gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 03:09:12 25 4
gpt4 key购买 nike

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

最佳答案

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com