LoginSignup
6
7

More than 5 years have passed since last update.

iOS位置情報まとめ

Last updated at Posted at 2018-01-29

【使う記述】

■ 位置情報の精度

// バックグラウンドからの位置情報取得
locationManager.allowsBackgroundLocationUpdates = true
// 更新頻度(didUpdateLocations:に渡す位置情報)、mの値を設定
locationManager.distanceFilter = 2.0
// 精度を指定。最高精度
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation


■ バッテリー消費削減

// 位置情報を新たに取得する必要がない場合、取得をポーズしてくれる
// 一度ポーズになった際はアプリがフォアグラウンドにくるときしか位置情報取得は再開されない。
locationManager.pausesLocationUpdatesAutomatically = true
// 位置情報更新を自動的にポーズするための判断基準
locationManager.activityType = .fitness

6
7
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
6
7