LoginSignup
0
1

More than 3 years have passed since last update.

緯度・経度を指定してApple標準マップアプリを起動する

Posted at

やりたいこと

指定の緯度・経度の場所を中心とした状態で、Apple標準マップアプリを起動したい。

実装方法

Apple標準マップアプリを開きたい場所で下記のコードを実行。
この例では、東経135度、北緯35度を中心として表示する。
zの値を変更すると、縮尺を変更できる。

OpenAppleMapApp.swift

let url=URL(string: "http://maps.apple.com/?q=35.0000,135.0000&z=14")!
UIApplication.shared.open(url, options: [:], completionHandler: nil)

動作確認環境

Xcode: 12.2
Swift: 5.3.1
iOS: 14.2

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1