Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Google Maps iOS SDK Tutorial: Getting Started

Learn how to use the Google Maps iOS SDK to retrieve the user's current location and search for nearby points of interest, such as bars and restaurants.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/197-google-maps-ios-sdk-tutorial-getting-started

Thank you for updating this tutorial to Swift 4. Have a great day! :slight_smile:

This is a good tutorial. Thanks. There is some information missing, though. For example, you have a function named fetchNearbyPlaces, which takes two arguments, searchRadius and searchedTypes. I guess searchedTypes comes from an older tutorial version brought with GoogleDataProvider.swift.

@ron.kliffer Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi,
searchTypes are taken from TypesTableViewController, as mentioned in the beginning of the tutorial. Is somethings unclear there? I’d be happy to elaborate

Hi,
I’d be happy to help? What is your question

@ron.kliffer I was just sending you a heads up for the other question. Thanks for replying! :]

@ron.kliffer Hey Ron. I am fairly new to Swift and I loved your tutorial, but when I got to the point where the colored location pins were supposed to be showing I ran into some trouble. They aren’t popping up anywhere. I’m getting a couple errors. 1. CoreData: annotation: Failed to load optimized model at path ‘var/…/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo’. Error 2. HTTP load failed.
I tried to solve them on my own via google with no success. So I downloaded your full project and tried running that, still no location pins of the restaurants.

1 Like

@dcritch
ou create an api key and added it to the code?

HI - thanks for this tutorial!

Im unable to get all the places to show up. they did briefly but went away. no error while running in stimulator or on my iphone 7. however, none of the places show up - either in the starter or the completed version! help!

@ron.kliffer Yes, I created an API Key and added to the one spot in the AppDelegate.swift file and even set key restriction to iOS only and used the correct bundle identifier to fix a different error I was getting. The map pops up and addresses are correctly show on the bottom of the screen which makes me think that the API is working… but NO PINS representing the restaurants and other stores anywhere.

@ron.kliffer Do you have any feedback regarding this? Thank you - much appreciated! :]

@dcritch You shouldn’t restrict the key to iOS only, an unrestricted key is what you need for this tutorial

@ron.kliffer I had the same problem - this is the second tutorial I have gone through with google maps… first one wanted a restricted iOS key so I did the same for this. Googled error code, decided to unrestrict the API key and that worked.

However, I don’t have any pins popping up… same as @dcritch

@ron.kliffer I just ran it again. here is a debug readout:

2018-03-08 10:45:57.012162-0500 Feed Me[32017:2547098] Task .<1> finished with error - code: -999
2018-03-08 10:45:57.017888-0500 Feed Me[32017:2547093] Task .<1> HTTP load failed (error code: -999 [1:89])
2018-03-08 10:45:57.094772-0500 Feed Me[32017:2546904] Google Maps SDK for iOS and Google Places API for iOS version: 2.6.30421.0

Again, no pins popped up for any of the items searched for. (this applies to both starter and completed versions)

I checked my API settings, and it seems the Maps part is getting requests, but Places has no request. Perhaps one would need two separate API’s? (that is what the first tutorial that I tried used; for this one I am using one API for both Places and Maps)

Would you like me to take a look at your code and see if I can spot anything?

Sure, that would be nice. Where can I send you the zip file? (BTW - im having the same problem ass your completed code, and ive compared it - don’t think I’m missing anything)

Since it seems like we have the same problem, if found, could you please post the solution here?

@ron.kliffer Thanks, Ron Kliffer. It was because, I think, of the API key restriction to iOS as you suggested. Much appreciated. :slight_smile: Super cool tutorial! :+1:t2::+1:t2:

@ron.kliffer Was wondering if you could point me to a resource that covers how to cache map tiles and/or features for offline use? Thanks!