2016-04-01 6 views
2

In meinem iOS-Projekt verwende ich Google Maps SDK zum Abrufen von Auto-vollständigen Adresse. Daher möchte ich meine Ergebnisse auf ein bestimmtes Land beschränken. Laut Google-Dokumentation muss ich die Eigenschaft "Land" von GMSAutocompleteFilter Klasse verwenden. In Google-Dokumentation hat es "Land" -Eigenschaft tatsächliche .h-Datei in Google Maps SDK tut es nicht."Country" -Eigenschaft fehlt in GMSAutocompleteFilter von Google Maps iOS SDK

Dokumentation Link: https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_autocomplete_filter.html#properties

GMSAutocompleteFilter.h Datei:

// 
// 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 

Jede Hilfe ist schätzen würde.

Antwort

1

Endlich loswerden des Problems bestätigt, dass es aufgrund der älteren Version von Google Maps iOS SDK war. Ich hatte Google SDK ohne Angabe einer Versionsnummer in podfile abgerufen, es gab mir wie 1.10 Version. Daher habe ich die Google SDK-Pods mit der Version 1.12.3 aktualisiert, dann habe ich das Feld "country" in der Klasse GMSAutocompleteFilter.

+0

Danke für Ihre großartige Antwort. –

1

Möglicherweise müssen Sie Ihr Google Maps SDK aktualisieren.