【问题标题】:Unable to filter google map无法过滤谷歌地图
【发布时间】:2016-08-26 12:40:05
【问题描述】:

我正在尝试将 google 地方自动完成限制在印度,但无法过滤,请有人提供帮助。
我的谷歌地图框架, #导入

     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 地方自动完成限制在印度,但无法过滤,有人可以建议帮助吗?

【问题讨论】:

    标签: ios objective-c google-maps sdk


    【解决方案1】:

    来自文档:

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

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

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

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

      yourFilter.country =@"IN";
    

    这里是国家列表codes.

    【讨论】:

      猜你喜欢
      • 2013-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多