Page 1 of 1

iphoneCurrentLocation() not working

Posted: Fri Jan 06, 2012 12:54 pm
by tzenobite
hi to all
i can't get the iphoneCurrentLocation() function working
it wasn't working in another little app i wrote last week but i was wondering if i've made some mistake somewhere
to be sure i've just made a new stack with a single card with
on opencard
iphoneStartTrackingLocation
end opencard
and a single button with

Code: Select all

on mouseup
   answer iphoneCurrentLocation()
end mouseup
the stack doesn't work neither in the simulator nor in the actual iphone, even waiting many minutes before click the button
i'm really frustrated, i'm asking if someone here will be so kind to try the same or, if he/she has a stack like this that's working, to send it to me so i try what's wrong
i've all the rest of the stack ready but without the gps working i'm stuck...
please help me!

Re: iphoneCurrentLocation() not working

Posted: Fri Jan 13, 2012 3:08 am
by Mark
Hi,

Put this into the script of the first card of your stack. Add one field to the stack. Test on a real device, not in the simulator. Make sure that the iPhone's GPS is turned on and that your app is allowed to track the location.

Code: Select all

on openStack
  if iphoneCanTrackLocation() then
    iphoneStartTrackingLocation
  else
    answer "This device has no GPS or location services have been turned off."
  end if
end openStack

on locationChanged
  put iphoneCurrentLocation() into fld 1
end locationChanged

on locationError
  answer "The location can't be tracked"
end locationError
Kind regards,

Mark

Re: iphoneCurrentLocation() not working

Posted: Fri Jan 13, 2012 3:35 am
by Dixie
tzenobite...

I have attached a stack... It is the scripts from the stack that was posted in the liveCode lessons on the web site, but it works... You can seeing it working well when you go to the shops for milk, or when you are taking the dog for a walk...:-)

be well,

Dixie