IOS 7.1.1 broke my google location URL

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

IOS 7.1.1 broke my google location URL

Post by jekyllandhyde » Sat Jun 21, 2014 3:53 am

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.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: IOS 7.1.1 broke my google location URL

Post by Simon » Sat Jun 21, 2014 5:14 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: IOS 7.1.1 broke my google location URL

Post by Jellicle » Sat Jun 21, 2014 10:57 am

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
14" MacBook Pro
Former LiveCode developer.
Now recovering.

jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

Re: IOS 7.1.1 broke my google location URL

Post by jekyllandhyde » Mon Jun 23, 2014 2:16 am

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: IOS 7.1.1 broke my google location URL

Post by Simon » Mon Jun 23, 2014 2:57 am

Yep that's all
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply