Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mnaruse/91ad269ee75cebc2d2c536ffcc6f2521 to your computer and use it in GitHub Desktop.
Save mnaruse/91ad269ee75cebc2d2c536ffcc6f2521 to your computer and use it in GitHub Desktop.
WWDC20: What's new in location.
// iOS14
// プロンプトを表示し、一時的な位置精度のアップグレードを依頼する(アプリを閉じない限り有効)。
// なぜ正確な位置情報が必要なのか、明確に説明する文字列を表示するために、
// Info.plist の NSLocationTemporaryUsageDescriptionDictionary をキーにした辞書に、目的キーを追加しなければならない。
@IBAction func userWantsToNavigate(_ sender: Any) {
// It looks like the user wants to navigate!
if manager.accuracyAuthorization == .reducedAccuracy {
manager.requestTemporaryFullAccuracyAuthorization(withPurposeKey: "WantsToNavigate") {
if self.manager.accuracyAuthorization == .fullAccuracy {
self.beginNavigation()
}
}
} else {
self.beginNavigation()
}
}
@mnaruse
Copy link
Author

mnaruse commented Jul 8, 2020

first commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment