mapbox / mapbox/MapboxGeocoder.swift

Read API base URL from Info.plist

未关闭
#107 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement
主要语言
Swift
星标
133
派生
46
PR 合并指标
30 天内没有已合并 PR

描述

If no host is passed into Geocoder(accessToken:host:), the fallback hostname should be either api.mapbox.com or api.mapbox.cn depending on the value of MGLMapboxAPIBaseURL in Info.plist:

https://github.com/mapbox/MapboxGeocoder.swift/blob/faa288dcf09f9dbcab1a54e61e741932f3945239/MapboxGeocoder/MBGeocoder.swift#L154

This would be consistent with how we read the access token out of Info.plist:

https://github.com/mapbox/MapboxGeocoder.swift/blob/faa288dcf09f9dbcab1a54e61e741932f3945239/MapboxGeocoder/MBGeocoder.swift#L147

This will make it easier for developers to keep their map and geocoder usage in sync, since Geocoder.shared would automatically pick up the API endpoint specified in Info.plist. Developers who need a different value for the geocoder can still override the API base URL when creating a separate Geocoder instance.

/cc @pdgoodman

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 MapboxGeocoder/MBGeocoder.swift 第 147-154 行附近开始,将 Info.plist 中现有的 access-token 查找与回退 host 逻辑进行比较。当省略 host 时从 MGLMapboxAPIBaseURL 选择 api.mapbox.com 或 api.mapbox.cn,而显式提供的 host 仍然作为覆盖值时,修改就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
swift
领域
mobile-dev
Issue 类型
功能
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。