Re: Google SDK IOS Attribution Text - google-maps-sdk-ios

According to Google IOS SDK documentation, I am suppose to call GMSServices openSourceLicenseInfo to display the attribution text.
I have a (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil in my infoViewController where I call the [GMServices openSourceLicenseInfo], but nothing is appearing.
What am I doing wrong?

+[GMSServices openSourceLicenseInfo] returns an NSString. You have to display the string yourself somewhere within the UI of your app.

Related

Using WebKit to show HTML in macOS - Blank View

Need to show HTML pages within app using WebView in WebKit framework.
This code should do it, but only get a blank white screen, no error messages. Thanks for any help of alternate solutions.
#property (weak) IBOutlet WKWebView *webView;
NSURL * myURL = [NSURL URLWithString:#"http://www.jzmobile.com"];
[_webView loadFileURL:myURL allowingReadAccessToURL:myURL];
[_webView.navigationDelegate self];
There is an Entitlement called: com.apple.security.network.client, that must be set to YES and it works! In iOS there is a plist called: App Transport Security Settings where you list the URL's you wish to access in the app. Thanks to theNextMan!

get dynamically loaded html using alamofire + swift

I am trying to request a website's html code and use it in an app in Xcode (Swift 3.0) and the pod Alamofire. In the html code online, the data contents that I want to scrape are in a div class that returns data from an Events calendar, in the form of a javascript web plugin. Since the website is not static, when I request the html and print the resulting response as a string, the data I want is not contained in the string. A message appears that says:
<noscript>Your browser must support JavaScript to view this content.
Please enable JavaScript in your browser settings then try again.
Events calendar powered by Trumba
</noscript>
My code using Alamofire looks like:
func downloadCalendar(){
Alamofire.request(urlString).responseString { (AlamofireResponse) in
print(AlamofireResponse.result.value!)
}
}
The urlString is a variable for the actual webpage's url.
Is there a way to get all of the html that appears in the html online into Xcode using Alamofire? If it's not possible with Alamofire is there another way to do this using Swift?
I've tried to accomplish a similar thing, unfortunately to no avail...
It seams AlamoFire grabs the first response it gets....
There is a workaround - use UIWebView:
static let webView = UIWebView()
self.webView.loadRequest(URLRequest.init(url: URL.init(string:"http://example.com")!)
DispatchQueue.main.asyncAfter(deadline: .now()+10.0) {[unowned self] in
if let html = self.webView.stringByEvaluatingJavaScript(from: "document.documentElement.outerHTML")
{print(html)}
}
Where 10.0 is the approx number of seconds required for javascript to finish loading the webpage data.
However since: it's not thread safe, you must use a singleton webView,
import UIKit and can't do it in the background - it's far from the perfect solution...
It might be easier to setup a proxy webserver in between to do the parsing for you.
Cheers!

set language for google maps iframe

I have changed the language for the google maps to Hebrew in the language setting but I would like to use the <iframe> code for my website. However, I can only seem to get this in English. How do I set it for Hebrew?
The URL has hl=he but I can't seem to get it to work for the <iframe> code.
My code is:
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d27130.99130966173!2d35.186535!3d31.787558!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x1502d64c6e5bf91d%3A0x2f55a98e4e4ab5e9!2z15vXoNek15kg16DXqdeo15nXnSAxNQ!5e0!3m2!1siw!2s!4v1395222081666" width="600" height="450" frameborder="0" style="border:0"></iframe>
Thanks
You need to add language parameter of API call for embed map. For Hebrew language, src of <iframe> should be like:
src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d27130.99130966173!2d35.186535!3d31.787558!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x1502d64c6e5bf91d%3A0x2f55a98e4e4ab5e9!2z15vXoNek15kg16DXqdeo15nXnSAxNQ!5e0!3m2!1siw!2s!4v1395222081666&language=iw"
More info at Google Maps Embed API
More info about Google Maps API language support:
https://developers.google.com/maps/faq#languagesupport
idk if this is really functional for other countrys but when im building a mock, and i found a google map iframe, and my client is by Example: US but im Mx the:
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3063.7150513838938!2d-84.19918628432937!3d39.83580597943695!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x884081e28cd77f07%3A0xf7f318d105021243!2sBuckeye+Harley-Davidson!5e0!3m2!**1ses!2smx**!4v1556548028269!5m2!**1ses!2smx**"
allowfullscreen></iframe>
i just update this info in the Url, 1sen!2sus, then the iframe is shown in english.
i hope this can helps to you to.
In 2016 it doesn't work anymore for embedded code directly taken from maps.
But &language=ru would work if you generate your code here: https://developers.google.com/maps/documentation/embed/start
You'll have to create api key.
Also you can use link like this -
src="https://maps.google.com.ua/maps?q=Майдан+Незалежності,+Київ&hl=uk&output=embed"
Майдан+Незалежності,+Київ - map locaton
uk - language
While using Google Map embeed iframe you can replace default language parametr on the src , you can look at at my example I point the placement of default language code : For example - az for Azerbaijan language
<iframe class="map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3038.7779420053535!2d49.85933131574896!3d40.39161387936813!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x40307d151fdf42df%3A0xb3dd9195f4676922!2z0JzQuNC90LjRgdGC0LXRgNGB0YLQstC-INC-0LHRgNCw0LfQvtCy0LDQvdC40Y8g0JDQt9C10YDQsdCw0LnQtNC20LDQvdGB0LrQvtC5INCg0LXRgdC_0YPQsdC70LjQutC4!5e0!3m2!1sru!2s!4v1574328901852!5m2!1s{you can find this point and replace with your locale language for example 'az' then iframe will translate into your locale language}!2s" width="600" height="450" frameborder="0" style="border:0;" allowfullscreen=""></iframe>
I had the same problem.
I am a Dutchman living in Brazil.
I developed a website for a Brazilian firm.
The result the iframe rendered in the web-page was in Dutch.
Then my client tested the site and everything was in Portuguese.
The answer can be found in the native browser settings (Dutch for me), (Portuguese for my client).
Dirk Detmar
Teresina, Piaui
Brazilie
While using Google Map embed iframe changing the default language parameter works for me. See here which parameter to change:
In the image currently, the Nepalese language is used and if we change the language parament "ne" to "en", all the text in the map will appear in the English language.
Also, you can change the language parameter from the google maps page. In the bottom right corner, click the location icon which shows your location, and change it to the required country you want.
So to sum the answers to this question up, the language key depends on what API you are using:
https://www.google.com/maps/embed
key : hl
list of possible parameters (search page for keyword "hl")
https://www.google.com/maps?output=embed
key : language
list of possible parameters

Showing Google Maps in OpenERP

I wanted to include Google maps in a module of OpenERP. As far as I know until I use iframe tag of HTML I wont be able to show Google maps in OpenERP but in OpenERP I have only two kinds of file one is .xml and other is .py. Now how am I supposed to add iframe with only these two file in hand. Any ideas ?
Thank you
There is module called google_map in openerp addons. Install that module to get the google map inside openerp and if needed make the necessary changes by creating your own custom module
In the 2012 OpenERP Days one of the presentations demonstrated how to craete a custom Webclient widget. The example used was a geo widget that could display and address as a Google Map indide a froam view. The code is available here.
You can try out Camptocamp's geoengine addon. This addon is meant to display data from the OpenERP database in a custom view using a map. It does not use an iframe to embed a googlemap, afaik.
https://launchpad.net/geospatial-addons
This is an example for openning the map in a new link where the html file which contains the html and java script code for the google map located in
static/src/googlemaps/get_place_from_coords.html
and the following method will be called when clicking the open google map button in the openerp interface:
def button_open_google(self, cr, uid, ids, context=None):
for place in self.browse(cr, uid, ids):
url="/tms/static/src/googlemaps/get_place_from_coords.html?" + str(place.latitude) + ','+ str(place.longitude)
return { 'type': 'ir.actions.act_url', 'url': url, 'nodestroy': True, 'target': 'new' }

Google's autocomplete in my form

I have a form on my website which forwards the textbox input to www.google.com/search?q=.... Is there any possibility to get this autocomplete / autofill features google provides when searching over google.com. Firefox uses google's autocomplete function in the search bar next to the url bar, but how can I get this kind of information for my web form?
There was the Google Suggest API that allowed to use autocomplete on custom keywords. But it seems google has removed it. But I found out that you can still access the API. There are URLs for JSON and XML.
JSON
http://clients1.google.com/complete/search?hl=en&q=<your query here>&client=hp
XML
http://clients1.google.com/complete/search?hl=en&q=<your query here>&output=toolbar
Without any warranty.
If you want to get autocomplete on a text box. You can combine that with jQuery UI Autocomplete
Here an complete example with google auto suggest
http://googlesuggest-jquery.googlecode.com/svn/trunk/
The new url is:
http://suggestqueries.google.com/complete/search?client=firefox&q=YOURQUERY
the client part is required; I did't test other clients.
In addition to RickyA´s answer you can filter the suggestion by media using bs parameter:
http://clients1.google.com/complete/search?hl=en&q=stackoverflow&output=toolbar&ds=
youtube: ds=yt
books: ds=bo
products: ds=sh
news: ds=n
images: ds=i
web: ds=
recipes: ds=r