Question

I am creating an app that displays my business and my business only.

I've been able (with the help of Ray Wenderlich tutorial) to make it so that it displays locations by type, name etc...

I know it's not possible to search by id or reference which means I'm stuck with name and keyword search.

My questions:

a) How can I do a place search and be sure that it shows my business only (one or more results depending on the number of venues) and no business with a similar name?

For example: If I do a search by name for McDonalds it will return "McDonalds", "McDonalds House", "McDonalds Burger Joint" etc etc...


b) The following code:

-(void)plotPositions:(NSArray *)data {
      for (int i=0; i<[data count]; i++) {
           NSDictionary* place = [data objectAtIndex:i];
           NSString *name=[place objectForKey:@"name"];
               if ([name isEqualToString:@"McDonalds"]{
                   [mapView addAnnotation:placeObject];
               }
  }

works for what I'm looking for, I think.
But if, for some reason, there are 2 or more businesses called "McDonalds" it will display them all.
Is there a way to get over this using the Google Places API?

c)Does the Foursquare API allow any of this?

Thank you!

Was it helpful?

Solution

If you want to stick to the google places API, you can combine multiple properties that you know about your business to narrow the list of returned places down. The best bet for this would probably name + location, since the location should be already pretty unique and known beforehand, since it's your business. I would suggest looking for the name and then picking the one that is closest to the actual location, but no farther away than x, just in case google places fails and doesn't return your business.

Which brings me to another point, since it's your business and you know all the info, maybe you could provide it from your own server instead of relying on google? You could, for example, have a static plist on your server with all the information you need. This way you can update it when you need to (for example new phone number or something like that).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top