Page 1 of 1

Digital Compass and iOS

Posted: Mon May 02, 2011 7:29 am
by gwyy
Has anyone been able to get the iPhone compass working in LiveCode?

I've tried the "How do I get the Location and use the Digital Compass in iOS?" lesson example and none of the compass-related functionalities work for me:

I can start "Location Tracking" and get my current location in the simulator and on my iPhone 4, even though "iphoneCanTrackLocation ()" and "iphoneStartTrackingLocation" produces an error when not running on the simulator or a real iPhone 4.
However, the heading tracking doesn't work; "iphoneStartTrackingHeading", "iphoneCanTrackHeading ()" and "iphoneCurrentHeading()" all produce errors and don't work on the iOS simulator or an actual iPhone 4.

My environment:
LiveCode 4.5.3 (also tested on colleague's LiveCode 4.6.1, iphoneCanTrackHeading () returns false)
XCode version 4.0.2
iOS Simulator version: 4.3
iPhone 4 OS: 4.3.2

Does anyone have any idea what I might be doing wrong or any suggestions on how to access compass data using LiveCode?


Thanks,
Gordon.

Re: Digital Compass and iOS

Posted: Fri May 06, 2011 3:53 am
by observ3
I managed to get everything to dump to a bunch of text fields.
Very heavily based on the examples in the documentation, with some added code for the fields and compass.
It worked on my iPhone 3GS. Updated every few feet as I went for a walk.

Hope this helps.

Re: Digital Compass and iOS

Posted: Fri May 06, 2011 7:10 am
by gwyy
Thanks for your example. I've just tested it on my iPhone 4 after associating it with one of my provisional profiles. I select "GPS On", but then pressing the "get location" button doesn't do anything.

I've attached my Livecode file to this post:
  • When I run it on the simulator or on iPhone, none of the green buttons do anything.
  • After starting location tracking, "Get current location" displays the GPS location OK.
  • After I click "Start Heading Tracking", clicking "Get current heading" displays "1" on the status field, but it doesn't show any compass information in the other field.
Does it work for you?

BTW, which version of LiveCode are you running?

Re: Digital Compass and iOS

Posted: Wed Nov 30, 2011 5:56 pm
by shankez
Hi gwyy,
have you resolved your issue? Me too I have your exact problem, and I can't figure out why...

Re: Digital Compass and iOS

Posted: Fri Dec 02, 2011 2:19 am
by gwyy
Hi Shankez,
I think it's the version of LiveCode I was using. It won't work on 4.5.3 because apparently the compass is not supported. I don't think it's supported on 4.6.1 either. It was some time ago, but I think I got it going temporarily after I managed to download a demo of 4.6.2, but don't quote me on that. Unfortunately, I'm still using LiveCode 4.5.3 and things have gotten too busy for me since then, so I've not come back to it yet. I do wish the online docs and examples tell you which LiveCode versions are supported!!!

G.