iOSの設定
インストール
iOSは Apple MapKitを使用します。 したがって、 not iOSでGoogle Maps API キーが必要です。
もし enableCurrentLocationを呼び出す場合、 ios/App/App/Info.plist:
<key>NSLocationWhenInUseUsageDescription</key><string>We use your location to show you on the map.</string>Copy to clipboard keepAlive so enableCurrentLocation 許可が与えられた後、
の位置情報を信頼性よく解決できるようにします。
Section titled “ウェブビューの背後にあるマップ”ネイティブ MKMapView mounts into the Capacitor WKWebView hierarchy and tracks the bound DOM element through onResize そして onDisplay。Ionicページが再入ると、プラグインのパスを呼び出すと、WebKitがスクロールビューを再構築した場合にマップを再マウントします。
透明なウェブビューまたはページの背景を使用して、マップがHTMLレイヤー上のマップコンテナを通して表示されるようにします。
In toBack モードでは、 data-map-overlay HUD Wrappersに
を設定してください。
READMEオーバーレイCSSがタップを有効にします。iOSネイティブブリッジはまた、 takeSnapshot, searchAutocomplete, searchPlaces, searchResolve, geocode, そして reverseGeocode. これらは NativeMap クラスラッパーにはまだない。 MapKit 検索やジオコーディングを iOS で実行するには、低レベルのプラグインハンドルで呼び出す。
import { registerPlugin } from '@capacitor/core';
type NativeMapBridge = { takeSnapshot(options: { id: string }): Promise<{ image: string }>; geocode(options: { address: string }): Promise<Record<string, unknown>>;};
const NativeMapBridge = registerPlugin<NativeMapBridge>('NativeMap');