google maps - iOS GMSAutoComplete result with in boundaries -


i need find out google places in boundary. have implemeted google place autocomplete , tried pass bounds region. still gives me result not present in boundaries.

 gmscoordinatebounds *bounds = [self getgmsboundswithradiusinmeters:20];  gmsautocompletefilter *filter = [[gmsautocompletefilter alloc] init]; filter.type = kgmsplacesautocompletetypefiltercity;  gmsplacesclient *placeclient=[gmsplacesclient sharedclient];  [placeclient autocompletequery:place                           bounds:bounds                           filter:filter                         callback:^(nsarray *results, nserror *error) {                             if (error != nil) {                                 nslog(@"autocomplete error %@", [error localizeddescription]);                                 return;                             }                              searchedplaces=results;                              uiactionsheet *actionsheet = [[uiactionsheet                                                                   alloc ]initwithtitle:@"select place" delegate:self cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:nil];                              (gmsautocompleteprediction* result in results) {                                  [actionsheet addbuttonwithtitle:[self getplacetitle:result.attributedfulltext.string]];                             }                           [actionsheet showinview:self.view];                          }];  -(gmscoordinatebounds*)getgmsboundswithradiusinmeters:(float)radius{ cllocationcoordinate2d center=cllocationcoordinate2dmake(28.77, 77.77);   mkcoordinateregion region = mkcoordinateregionmakewithdistance(center, radius*2, radius*2);  cllocationcoordinate2d  northeast = cllocationcoordinate2dmake(region.center.latitude - region.span.latitudedelta/2, region.center.longitude - region.span.longitudedelta/2); cllocationcoordinate2d  southwest = cllocationcoordinate2dmake(region.center.latitude + region.span.latitudedelta/2, region.center.longitude + region.span.longitudedelta/2);  gmscoordinatebounds* bounds = [[gmscoordinatebounds alloc]                                initwithcoordinate: northeast                                coordinate: southwest];  return bounds; } 

but returns result beyond radius. can suggest how result in boundaries.

may can fetch userlocation through clllocationmanager , pass gmsplacesclient in way

 cllocationcoordinate2d northeast = cllocationcoordinate2dmake(_userlocation.latitude + 0.15, _userlocation.longitude + 0.15);     cllocationcoordinate2d southwest = cllocationcoordinate2dmake(_userlocation.latitude - 0.15, _userlocation.longitude - 0.15);     userbound = [[gmscoordinatebounds alloc] initwithcoordinate:northeast                                                       coordinate:southwest]; 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -