Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS simulator and XCode to simulate Compass?

I am aware there is now a way to simulate location, but is there a way to simulate compass values?.

like image 965
Oscar Gomez Avatar asked Nov 09 '11 02:11

Oscar Gomez


1 Answers

Compass is not in the list of the hardware interactions supported by the simulator and CLLocationManager headingAvailable reports it's not available on the simulator.

Also, in this doc:

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.

Specifically CLLocationManager has this class property to check if the compass is available:

+ (BOOL)headingAvailable

If I run this under the simulator:

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

Outputs:

2011-11-08 22:38:26.873 Craplet[39975:b603] headingAvailable: 0
like image 102
bryanmac Avatar answered Sep 22 '22 00:09

bryanmac