I ran across an interesting problem today where I was trying to use TTStyledText from the Three20 project to create a TTStyledTextLabel that had text with links nested within it. I was trying to
Map here.
I was doing this with the following (simplified code):
[TTStyledText textFromXHTML:@"Map <a href=\"http://www.google.com/maps?f=q&hl=en\">here</a>." lineBreaks:YES URLs:YES];
As soon as I tried to put a URL in that had multiple URL parameters (and thus an &) things would disappear.
From briefly looking at the Three20 source code, I believe this because the parsing of the XHTML text is being done with an XML parser. As soon as I replaced the &s with &s things started to work. This can be done using the following code:
[@"Map <a href=\"http://www.google.com/maps?f=q&hl=en\">here</a>." stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
Thanks for posting your code. Were you able to open the “Maps” application with this? I was only able to open safari with this URL. I am trying to open the Maps application. Would appreciate any pointers? THanks.
Thank you !
That saved me a lot of time !
Very useful this tip! Thanks!