簡體   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