I am using a Google API to finding latitude longitude from Address location. And its working fine in English language settings. But when select Danish setting in Internationalization then it gives a server error from "Google". As I think there may be required to do localization in app but how?
You can choose the language you use for Google products and search results. To change the language the Google app uses, change your phone's language setting. When you change this setting, it will change the language of all apps on your phone.
The location and context APIs harness the sensors and signals of mobile devices to provide awareness of user actions and their environment, enabling delightful and engaging experiences that simplify user interactions, provide assistance, and help users to better understand themselves.
Language support. The Translation API's recognition engine supports a wide variety of languages for the Phrase-Based Machine Translation (PBMT) and Neural Machine Translation (NMT) models. These languages are specified within a recognition request using language code parameters as noted on this page.
This API Project Is Not Authorized To Use This API You’ll get this server error when you try to access one of the Google Maps Libraries (such as Places API ) without enabling it on the Google Cloud Console. The API service will return a response JSON object in which you can find the error under the error_message property.
Muhammad is giving the answer above, but I'll take the opportunity to explain what (I think) the issue is as well, as I had this issue in live production code a few weeks ago.
NSURL
is flat out bad with unescaped strings with "special" content (e.g. UTF). First thing I'd do is check if the NSURL
you get back is nil
.
The way to do NSURL
strings is to use stringByAddingPercentEscapesUsingEncoding
before passing the string in.
This simple example demonstrates this:
NSString *string = @"http://test.com/teståäötest";
NSLog(@"url with string! %@", [NSURL URLWithString:string]);
NSLog(@"url with escaped string! %@", [NSURL URLWithString:
[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]);
with output
url with string! (null)
url with escaped string! http://test.com/test%C3%A5%C3%A4%C3%B6test
I am not sure about AFNetworking, but I would do it as below with Apple's NSURL.
Assume your URL is a string named "googlapiurl", your NSURL should be initiated as:
[NSURL URLWithString:[googlapiurl stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With