Reputation: 5107
In my iOS project I am using Google maps SDK for fetching auto complete address. Hence I want to restrict my results to a specific country According to Google documentation I have to use "country" property of GMSAutocompleteFilter class. In Google documentation it has "country" property actual .h file in Google maps SDK it doesn't.
Documentation link: https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_autocomplete_filter.html#properties
GMSAutocompleteFilter.h File:
//
// GMSAutocompleteFilter.h
// Google Maps SDK for iOS
//
// Copyright 2014 Google Inc.
//
// Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
// Service: https://developers.google.com/maps/terms
//
/**
* The type filters that may be applied to an autocomplete request to restrict results to different
* types.
*/
typedef NS_ENUM(NSInteger, GMSPlacesAutocompleteTypeFilter) {
/**
* All results.
*/
kGMSPlacesAutocompleteTypeFilterNoFilter,
/**
* Geeocoding results, as opposed to business results.
*/
kGMSPlacesAutocompleteTypeFilterGeocode,
/**
* Geocoding results with a precise address.
*/
kGMSPlacesAutocompleteTypeFilterAddress,
/**
* Business results.
*/
kGMSPlacesAutocompleteTypeFilterEstablishment,
/**
* Results that match the following types:
* "locality",
* "sublocality"
* "postal_code",
* "country",
* "administrative_area_level_1",
* "administrative_area_level_2"
*/
kGMSPlacesAutocompleteTypeFilterRegion,
/**
* Results that match the following types:
* "locality",
* "administrative_area_level_3"
*/
kGMSPlacesAutocompleteTypeFilterCity,
};
/**
* This class represents a set of restrictions that may be applied to autocomplete requests. This
* allows customization of autocomplete suggestions to only those places that are of interest.
*/
@interface GMSAutocompleteFilter : NSObject
/**
* The type filter applied to an autocomplete request to restrict results to different types.
* Default value is kGMSPlacesAutocompleteTypeFilterNoFilter.
*/
@property(nonatomic, assign) GMSPlacesAutocompleteTypeFilter type;
@end
Any Help would be appreciate.
Upvotes: 2
Views: 1050
Reputation: 5107
Finally get rid of the issue acknowledged it was due to older version of Google maps iOS SDK. I had been fetching Google SDK without specifying any version number in podfile it gave me like 1.10 version. Hence I updated Google SDK pods with version 1.12.3 then I have the "country" field in GMSAutocompleteFilter class.
Upvotes: 1
Reputation: 11
May be you need to update your Google maps SDK. https://cocoapods.org/?q=google
Upvotes: 1