GoogleApisForiOSComponents icon indicating copy to clipboard operation
GoogleApisForiOSComponents copied to clipboard

Xamarin.iOS.Google.Places - Unrecognised selector sent to instance

Open ckomo opened this issue 3 years ago • 5 comments

Hi, I have upgraded to the latest packages for:

  • Xamarin.iOS.Google.Maps
  • Xamarin.iOS.Google.Places

And am receiving a native crash related to retrieving autocomplete results. The affected method is:

https://github.com/xamarin/GoogleApisForiOSComponents/blob/0b83095712e876b1dff42f8a04bd5e2a29aec50b/source/Google/Places/ApiDefinition.cs#L751

Invoking this will result in:

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[GMSPlacesClient findAutocompletePredictionsFromQuery:bounds:boundsMode:filter:sessionToken:callback:]: unrecognized selector sent to instance.

I believe this caused by changes in the Google Places library and the bindings have not been updated.

The method was deprecated in version 4.0: https://cloud.google.com/blog/products/maps-platform/announcing-version-40-maps-and-places-sdks-ios

The method was changed from: findAutocompletePredictionsFromQuery:bounds:boundsMode:filter:sessionToken:callback To: findAutocompletePredictionsFromQuery:filter:sessionToken:callback

I have created a sample project that reproduces it: https://github.com/ckomo/xamarin_google_places_crash

Thanks for looking into this, hopefully I have included enough information.

-Chris

ckomo avatar Feb 22 '22 07:02 ckomo

Hey Chris,

Great explanation! You're right the definition for that ObjC function call has changed,

- (void)findAutocompletePredictionsFromQuery:(NSString *)query
                                      filter:(nullable GMSAutocompleteFilter *)filter
                                sessionToken:(nullable GMSAutocompleteSessionToken *)sessionToken
                                    callback:(GMSAutocompletePredictionsCallback)callback;

I think this should also include the removal of CoordinateBounds & AutocompleteBoundsMode in a couple other spots as well as these are no longer used in Places 6.0.0 (https://github.com/dmariogatto/GoogleApisForiOSComponents/commit/29c9abea52d5e2e5700c4c70f7752f080d647b90).

dmariogatto avatar Feb 22 '22 10:02 dmariogatto

Thanks for the quick reply, is there a time frame for this fix to be pushed out to Nuget package?

ckomo avatar Feb 22 '22 23:02 ckomo

Unfortunately no, I'm happy to make a PR, but I don't know what the plans are for this project. With all the binding changes in the latest version and the large gap between releases there are a few errors that have been introduced.

I'm happy to help out, but this really requires dedicated resources from Microsoft, with a proper testing method, maybe a pre-release channel & multiple eyes to look over binding changes.

dmariogatto avatar Feb 24 '22 22:02 dmariogatto

Yeah this would be good to get fixed also or if anyone else has found an alternative

johnclarete avatar Mar 29 '23 00:03 johnclarete

Hi team, Is there any update on this?

wiljoetradify avatar Jun 01 '23 03:06 wiljoetradify