Digital Compass and iOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gwyy
Posts: 3
Joined: Thu Apr 28, 2011 7:43 am

Digital Compass and iOS

Post by gwyy » Mon May 02, 2011 7:29 am

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.

observ3
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 34
Joined: Mon Oct 11, 2010 11:05 pm

Re: Digital Compass and iOS

Post by observ3 » Fri May 06, 2011 3:53 am

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.
Attachments
gps.livecode.zip
(2.34 KiB) Downloaded 360 times
Check out my LiveCode program, WriteSpire, on the App Store!

gwyy
Posts: 3
Joined: Thu Apr 28, 2011 7:43 am

Re: Digital Compass and iOS

Post by gwyy » Fri May 06, 2011 7:10 am

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?
Attachments
navRadar.livecode.zip
(3.07 KiB) Downloaded 307 times

shankez
Posts: 15
Joined: Sun Nov 20, 2011 3:25 pm

Re: Digital Compass and iOS

Post by shankez » Wed Nov 30, 2011 5:56 pm

Hi gwyy,
have you resolved your issue? Me too I have your exact problem, and I can't figure out why...

gwyy
Posts: 3
Joined: Thu Apr 28, 2011 7:43 am

Re: Digital Compass and iOS

Post by gwyy » Fri Dec 02, 2011 2:19 am

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.

Post Reply

Return to “iOS Deployment”