Page 1 of 1

IOS 7.1.1 broke my google location URL

Posted: Sat Jun 21, 2014 3:53 am
by jekyllandhyde
Livecode: 6.5.1

Back in January I published the latest release of my App and it tested fine under IOS 7.0.3.

Now on my iPhone with release 7.1.1 a minor part of my code is broken. Not sure how to fix.
Basically I read in the current latitude and longitude into variables and then construct a URL to pass to Google maps to map the location.
Here's the code snipets that worked before.

Code: Select all

---Here's the part where I store the coordinates---
put mobileSensorReading("Location",true) into tLocation
   put tLocation["latitude"] into tLat
   put tLocation["longitude"] into tLong
   put tLocation["timestamp"] into tStamp

--Here's where I construct the URL
put "http://maps.google.com/?q="&&tlat&&","&&tlong into tgoog
   put empty into char 27 of tgoog
   put empty into char 36 of tgoog
   put empty into char 37 of tgoog
The "put empty" code is because I get spaces in the URL string which need to be removed to construct a valid URL. This all works under IOS 7.0.3.
This is the output: http://maps.google.com/?q=49.263768,-123.209553

Under IOS 7.1.1 the put empty code removes the comma and the negative sign before the "123".
This is the output: http://maps.google.com/?q=49.32417 123.07237

This tells me that something has changed either in Livecode or IOS. Clearly the spaces don't need to be removed anymore under the latest IOS release.

I'm not sure how to fix this so I support the latest IOS release but also older IOS releases? I'm sure there is a way but I'm a beginner programmer and I'm a bit stumped.

Re: IOS 7.1.1 broke my google location URL

Posted: Sat Jun 21, 2014 5:14 am
by Simon
Hi jekyllandhyde,
Wow
put empty into char 27 of tgoog
How about

Code: Select all

replace space with "%20" in tgoog
Now you don't have to count the characters.

Simon
Edit Forgot the quotes

Re: IOS 7.1.1 broke my google location URL

Posted: Sat Jun 21, 2014 10:57 am
by Jellicle

Code: Select all

Put "whatever" && "something" into  foo


puts a space between those words in foo. The space is the consequence of using 2 ampersands. Using one ampersand joins the words without a space. So:

Code: Select all

Put  "whatever" & "something" into foo


...puts "whateversomething" into foo.

I think your first problem is you were using 2 ampersands where one would have done the trick :)

To remove spaces in a string I do:

Code: Select all

replace space with "" in foo
Gerry

Re: IOS 7.1.1 broke my google location URL

Posted: Mon Jun 23, 2014 2:16 am
by jekyllandhyde
Thanks for the replies:

So what I hear you saying is the code should be:

Code: Select all

put "http://maps.google.com/?q=" & tlat & "," & tlong into tgoog
   --put empty into char 27 of tgoog
   --put empty into char 36 of tgoog
   --put empty into char 37 of tgoog

Re: IOS 7.1.1 broke my google location URL

Posted: Mon Jun 23, 2014 2:57 am
by Simon
Yep that's all