derTuca / flutter_google_places_picker

Google Places Autocomplete for Flutter
MIT License
18 stars 28 forks source link

Cant get this running. The map shows up but not places below the map #9

Closed pretheesh closed 5 years ago

pretheesh commented 5 years ago

I am getting below error. places API is configured properly on cloud console. I can see google places version as 2.7 and I remeber reading this version is deprecated on 29th January. I tried everything on the error described below but no luck so far.

What could be the problem? Can someone help?

preview here: https://gph.is/g/4wzNbDZ


Places API error: Error Domain=com.google.places.ErrorDomain Code=-9 "The Places API for iOS is not enabled. See the developer's guide (https://developers.google.com/places/ios-api/start) for how to enable the Google Places API for iOS." UserInfo={NSLocalizedFailureReason=The Places API for iOS is not enabled. See the developer's guide (https://developers.google.com/places/ios-api/start) for how to enable the Google Places API for iOS., NSUnderlyingError=0x2818514a0 {Error Domain=com.google.places.server.ErrorDomain Code=-1 "(null)" UserInfo={NSUnderlyingError=0x281853690 {Error Domain=com.google.GTLRErrorObjectDomain Code=403 "Access Not Configured. Google Places API for iOS has not been used in project xxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/placesios.googleapis.com/overview?project=xxxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."

UserInfo={GTLRStructuredError=GMSx_GTLRErrorObject 0x2818510e0: {message:"Access Not Configured. Google Places API for iOS has not been used in project xxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/placesios.googleapis.com/overview?project=xxxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry." errors:[1] code:403}, NSLocalizedDescription=Access Not Configured. Google Places API for iOS has not been used in project xxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/placesios.googleapis.com/overview?project=xxxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.}}}}} [VERBOSE-2:shell.cc(184)] Dart Error: Unhandled exception: PlatformException(PLACE_PICKER_ERROR, The operation couldn’t be completed. The Places API for iOS is not enabled. See the developer's guide (https://developers.google.com/places/ios-api/start) for how to enable the Google Places API for iOS., null)

0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551:7)

1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:292:18)

#2 PluginGooglePlacePicker.showPlacePicker (package:google_places_picker/google_places_picker.dart:24:41) ______ [✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G3025, locale en-AE) • Flutter version 1.0.0 at /Users/xxx/flutter • Framework revision 5391447fae (3 months ago), 2018-11-29 19:41:26 -0800 • Engine revision 7375a0f414 • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297) [✓] Android toolchain - develop for Android devices (Android SDK 28.0.3) • Android SDK at /Users/xxx/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06) • All Android licenses accepted. [✓] iOS toolchain - develop for iOS devices (Xcode 10.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 10.1, Build version 10B61 • ios-deploy 2.0.0 • CocoaPods version 1.5.3 [✓] Android Studio (version 3.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 29.0.2 • Dart plugin version 181.5540.11 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06) [✓] VS Code (version 1.31.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 2.23.0 Appdelegate.m ___ #include "AppDelegate.h" #include "GeneratedPluginRegistrant.h" @import GooglePlaces; @import GoogleMaps; @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [GMSServices provideAPIKey:@"xxxxxxx"]; [GMSPlacesClient provideAPIKey:@"xxxxxxx"]; [FIRApp configure]; [GeneratedPluginRegistrant registerWithRegistry:self]; // Override point for customization after application launch. return [super application:application didFinishLaunchingWithOptions:launchOptions]; } @end
erf commented 5 years ago

I have the same issue.

erf commented 5 years ago

Maybe update the Pods to 3.0.3 as mentioned here ?

Or could it be some error with my Places API key? I enabled Places API in the dashboard, so should be ok.

pretheesh commented 5 years ago
  1. Tried to update Pods
  2. checked the API keys several times
  3. deleted and recreated the API keys with and without restrictions
  4. tried the plugin with a new project
  5. Upgraded all plugins and tested
  6. Upgraded flutter to 1.2.1 and tested

all these show the same error. Only @derTuca can help us :)

erf commented 5 years ago

@pretheesh did you try with an older Flutter version?

derTuca commented 5 years ago

Just checked the example project with my API keys and it works fine. I would suggest making sure not only that iOS keys are created, BUT ALSO that the API is enabled (if you can see it here it is not enabled). Please double-check and comment again if the issue still persists. Also, the plugin does not enforce a specific version of the pods, so a pod update should get them up to date.

erf commented 5 years ago

@derTuca do you need to create a restricted iOS spesific key? ( unrestricted does not work? )

i was using a unrestricted key, but it should be enabled.

derTuca commented 5 years ago

An unrestricted key should work fine, but it is very important that the SDK is enabled, per the link above.

erf commented 5 years ago

Places API are enabled. Maps and Geolocation API's also. Maybe an old API key is cached or something. WIll try to delete DerivedData folder and check API keys later.

erf commented 5 years ago

Did you notice the deprication warning @derTuca ?

It says:

Notice: The Place Picker (Android, iOS) is deprecated as of January 29, 2019. This feature will be turned off on July 29, 2019, and will no longer be available after that date. To continue using the Place Picker with Places SDK for iOS v.2.7.0 through the deprecation period, do NOT disable the Places SDK for iOS. Read the migration guides (Android, iOS) to learn more. 

There is also a migration guide.

erf commented 5 years ago

When i go to the link you supplied i can see the Places API listed, but when i press it, it says Enabled.

Also when i delete the Podfile.lock and do a pod install, it seem to install the 2.7.0 version, even when i do a pod outdated it says the latest version is 3.0.3. I try to do a pod update with no result.

@derTuca

erf commented 5 years ago

@derTuca could you supply a full working example. And perhaps created a temp valid Places Api key i could test?

pretheesh commented 5 years ago

I somehow managed to run the autocomplete.

  1. Changed my flutter version to 1.0.0
  2. Removed all the API keys from google console and re-enabled APIs
  3. Deleted pub-cache folder from the flutter SDK
  4. run pod update from ios folder
  5. run flutter packages upgrade
  6. open the Xcode project and changed the target version to 9.0 in the project tab
  7. run on simulator/device both worked fine except the map picker.

The places picker still doesn't work, but the autocomplete works. I don't know what is wrong.

derTuca commented 5 years ago

Per the migration guide, as mentioned above by @erf, updating the pods to the latest version will prevent the Place Picker from working, as that feature has been removed. I am currently a tad short on time, but I will update the plugin this weekend (hopefully) to mark the place picker as deprecated and update the docs respectively.

erf commented 5 years ago

This client migration url says that

The v.3.0.0 release of the Places SDK for iOS has been updated with new functionality. The current version of the Places SDK for iOS (v.2.7.0) is deprecated as of January 29, 2019, and will be turned off on July 29, 2019. 

Do you plan to update to v3.0.0 @derTuca ?

derTuca commented 5 years ago

I will keep the current version on a separate branch and update the master for the new version of the plugin, most likely, along with a new major version for the plugin.

erf commented 5 years ago

@pretheesh the guide says the following:

Prior to using the Places SDK for iOS, do the following:

Get an API key with iOS restrictions (not browser restrictions). You can use the same API key for your Maps SDK for iOS apps and your Places SDK for iOS apps.
Enable billing on each of your projects.
Enable the Places API service in Google Cloud Platform Console for each of your projects.

Did you try to restrict to iOS and enable billing?

derTuca commented 5 years ago

Ok, so I updated the plugin in order to use v3 of the Places SDK. Also, regarding the 2.7 pod being used even after pod update, it was due to the plugin having the deployment target set to iOS 8.0, while the minimum version for the v3 of the Places SDK is 9.0. Please follow the instructions in the docs and hit me up if the problem still occurs.

erf commented 5 years ago

@derTuca thanks for the update!

I managed to get the autocomplete working ( on iOS ) after i deleted the Podfile.lock and the Pods folder, so that so that the 3.0.3 libraries were installed.

I wish the map picker functionality was still there, are you planning on recreating this? perhaps using google_maps_flutter and geolocator?

derTuca commented 5 years ago

@erf Unfortunately I'm really short on time right now, and that is out of my required scope for the moment. If you (or anybody else) would like to do that though, I'd be more than willing to help.

erf commented 5 years ago

@derTuca No worries. I might recreate this functionality myself, but then i probably won't be using the places SDK, or your plugin, but rather build something from scratch using the two mentioned flutter packages, as the autocomplete functionality is probably not for building upon.