无法过滤谷歌地图

时间:2016-08-26 12:40:06

标签: ios objective-c google-maps sdk

我正在尝试限制Google地方自动完成到印度,但无法过滤,有人可以建议帮助 我的googlemap框架,       #import

     GMS_ASSUME_NONNULL_BEGIN

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

/**
 * The country to restrict results to. This should be a ISO 3166-1 Alpha-2 country code (case
 * insensitive). If nil, no country filtering will take place.
 */
@property(nonatomic, copy) NSString *GMS_NULLABLE_PTR INDIA;


@end

GMS_ASSUME_NONNULL_END

我正在尝试限制Google地方自动完成到印度,但无法过滤,有人可以建议帮助。

1 个答案:

答案 0 :(得分:0)

来自文档:

- (NSString* _Nullable) country [read, write, copy]

将结果限制为的国家/地区。

这应该是ISO 3166-1 Alpha-2国家/地区代码(不区分大小写)。如果为零,则不会进行国家/地区过滤。

对于印度,你应该这样做:

  yourFilter.country =@"IN";

以下是国家codes.

的列表