I am writing a simple app to help me geocode some addresses to use on my tomtom navigation device. I have the app almost working but the url to load a static map will not load in the webview object. I have included the code I use but cannot include my API key, so the url below will not load. In my app I can load “http://www.google.com” , So I know the app is working and assume I need to encode the more complex url somehow. The url that is throwing an error does load in Safari. The error is:
The variable URLWithString is not defined. (-2753)
The URL minus my api code is: http://maps.google.com/maps/api/staticmap?size=306x493&maptype=hybrid&sensor=false&markers=color:blue|label:S|47.2675853,-122.5846934|47.329264,-122.5801293&key = MYAPI KEY
set mapURL to "http://maps.google.com/maps/api/staticmap?size=306x493&maptype=" & maptype & "&sensor=false&markers=color:blue|label:S" & googleMarkers & "&key = " & queryKey
loadPage from mapURL
on loadPage from theURL
set URLWithString to call method "URLWithString:" of class "NSURL" with parameter theURL
set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
tell window "main"
set mainFrame to call method "mainFrame" of object (view "browser")
end tell
call method "loadRequest:" of mainFrame with parameter requestWithURL
end loadPage