IOS - How to provide suggestions when inputting locations - ios

How do you implement suggestions when a user starts typing in their city/location into an iOS app text field? For example, if you look at the yelp or maps app, when you start typing in a city it will provide suggestions based on what you start typing. Is there a way to do this, like somehow get a list of all the CLRegions in the CoreLocation framework, or some other way of implementing this?
Thanks for any help.

The best solution for this is to use someone else's (web-based) geocoding database - geocoding is a complex problem that you don't want to solve yourself :-). Geocoding is the act of taking a textual address and turning it into a latitude/longitude. Typeahead for geocoding is a helpful feature that requires fairly large databases that likely aren't suitable for mobile apps, thus my recommendation to use one of the web-based geocoding services for this.
Google's places API is probably a good candidate:
https://developers.google.com/places/documentation/autocomplete?csw=1
Check out this answer for some commentary from Google from 2011 when they first opened up that API in 2011:
Google Places API in iOS application

Related

How to use Walmart API with iOS app in Xcode? (swift language)

I've recently installed Walmart's API into my iOS app. The app's purpose is for the user to search for items using Walmart's API and then display the queried items to the user. However I am having a hard time finding any examples on how to use Walmart's API with Xcode and Swift language. Was curious if anyone could point me in the direction of how to properly use the API while using Swift language or if anyone has experience using the Walmart API in Xcode? I feel like it shouldn't be hard to accomplish what I am trying to do but right now I am a bit lost. All help and advice is appreciated in advance! Thanks.
Whenever An API is Created The Author gives out a Documentation, about the usage of the API, Requests Parameters etc.
So, Go through the Documentation of Your Needed API,
Once the Requests Are made in-app, they Generally respond you in JSON, XML etc.
Using these Incoming data you can Populate data in your APP

Rails app for food truck, using twitter to update the google map.

So I am writing a rails application for my friends food truck business.
The functionality that I am trying to create with this specific application is the ability for him to update the google map by posting a Geo-location tag on twitter.
A lot of the ruby gems that deal with google maps seem to be depreciated so I'm a bit lost at the moment. If anyone could just point me in the correct direction I would appreciate it.
I realize that this feature is just a quality of life feature but id like to be able to do it with embedded ruby and not have to break out the JavaScript (ugh). Ideal this kind of automation would be great for this particular type of website because my friend won't always have access to the back-end of the website when he is on the move. (Already able to update a map from an admin backend but its not good enough for a business that moves multiple places in a given day.)
anyways, thanks in advance. (if anyone wants me to post any of my code I will.)
So after reading your question, I thought it would be fun to tinker with the Twitter API again since I haven't used it in a while.
I went ahead and created a sample application for you that basically does what you were asking for. It looks for recent tweets from a user, grabs the latest one, then updates a Google map with a marker on that location.
Keep in mind that this was quickly thrown together, so it's far from perfect. But all the concepts should be there!
Feel free to reach out if you have any questions about the app or anything else. I'm always happy to help.

Obtaining locations around user API?

I'm attempting to retrieve locations around a user upon retrieving their current location. Is anyone familiar with which API's/Frameworks are best to accomplish this? I've tried Foursquare2 but it seems that half the locations don't return addresses. I need a better API to use, preferably one that will return addresses, and can't seem to find any others. I came across Google Places, but it appears to be in beta and not available unless I submit a form and wait. Is there a way to do this with Google Maps or the Facebook graph perhaps?
Depending on which device you use. For example if you want to retrieve location data from android use this api, for an ios device, use read the my location section in this doc. Hope this gives you some idea.

Confused with Apple Map Vs Google Map

This might be a very stupid question for some people but I want to be make sure about this.
In iOS6 Apple has updated its Map application and added his own map. Now if I develop any native application and include map(MKMapView) into this so are their any changes which I should be aware of them?
Previously, I was using Google web service to fetch the latitude and longitude between two locations and draw direction. Does Apple provide its own web services for the same?
are their any changes which I should be aware of them?
MKMapView will still work fine, but the map it displays will look a little different. Also, if you limit your app to iOS versions that use only Apple's maps, you might not be subject to Google's terms and conditions. Read your agreements.
Does Apple provide its own web services for the same?
There's CLGeocoder. It's a class, not a web service, but that just makes it easier to use.
Using MKMapView framework didn't change just because the images are different. It should work fine.
Google's Terms Of Service say that you can't show their data on someone else's maps. So if your app is still getting data from a Google webservice you'll need to use the Google Map SDK that they have put out, not the usual MKMapView on iOS 6+.
If you are only using Google's webservice to turn a human readable address into lat/long then you can do that using CLGeocoder as Caleb suggested, but Google offer other services too.

Google Places API Violation

I am using Google Places API to pull a list of resturants, and I am displaying them on map. However, since Apple has switched there map services over from Google in iOS 6.0, I am now in violation of Google's terms of use, which states that you must display Google data on a Google map.
"If your application displays Places API data on a map, that map must be provided by Google."
https://developers.google.com/places/policies#terms_of_use
I obviously need to change the map, because I am not going to release an application that is in violation. Any thoughts or suggestions on what to do? Should I go Google Maps with a web view? Does apple have some sort of Google Places API alternative?
Edit:
Using Google Maps through a web view is a hassle, i'd like to find an alternative to that, although it would technically work.
I decided to use Google Maps JavaScript API. Although, it is a little more difficult to deal with, mainly the JavaScript through Objective-C, it is a solution. The map is displayed through a web view, and I use JavaScript to interact with the map.
https://developers.google.com/maps/documentation/javascript/tutorial#api_key
I will wait to accept this answer, to see if anyone else has any thoughts. I just wanted to post this, in case it helps someone else.
Edit:
Google recently released a Maps SDK for iOS, this is the better solution now.
https://developers.google.com/maps/documentation/ios/
I would try to directly contact Google, explaining the situation, and ask them for written permission to use Apple's maps. This is more a legal question than programming. One would think that Google is aware that you can no longer display their maps using Apple's API and that, even regardless of the map, they would want you to use their places, as doing so generates advertising revenue for them.
Agree with #Owen here - you could get permission to leave your app unchanged until some possible future date when you might have to change it, or could you definitely go to the effort of changing it now and then possibly have to change it again in the future for some other reason.
If you could get a 100% guarantee that you could change it once and never have to change it again then I'd say do it now, but nothing's certain.

Resources