0

I am using the following code to get address from lat and long:

NSLog(@">>>>%f,%f",location.latitude,location.longitude);

[[GMSGeocoder geocoder] reverseGeocodeCoordinate:location completionHandler:^(GMSReverseGeocodeResponse *resp, NSError *error)
 {
     NSLog(@"response%@",resp);
 }];

When I try to do geocode with a correct lat and long, for a particular location, I get null as response and error is this. This is not happening with my android device.

I can see response as nil and error is:

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=https://clients4.google.com/glm/mmap, _kCFStreamErrorCodeKey=-2102, NSErrorFailingURLKey=https://clients4.google.com/glm/mmap, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=4, NSUnderlyingError=0x1659ae80 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSErrorFailingURLStringKey=https://clients4.google.com/glm/mmap, NSErrorFailingURLKey=https://clients4.google.com/glm/mmap, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=4}}}
ilim
  • 4,477
  • 7
  • 27
  • 46

2 Answers2

0

This issue arises because of your API key is expired, if you regenerate the API key in google console it will work and get your response

API key example: AIzaSyDleduRwellp3OwLMAOzLt4MZWsJMWqMvM

koPytok
  • 3,453
  • 1
  • 14
  • 29
0

Also check, if you're using simulator, that your simulator location setting is set to none. You can check via selecting your simulator and go to:

Debug > Location > none

Hope it helps.

Mohsin Khubaib Ahmed
  • 1,008
  • 16
  • 32