Qt Positioning iOSの場合
iOSアプリからのQt Positioning サービスの使用
iOSデバイスでアプリが測位サービスを使用できるようにするには、アプリが使用されているときに測位サービスが必要なのか、アプリがバックグラウンドで実行されているときに測位サービスが必要なのかに基づいて、エントリをInfo.plistファイルに追加する必要があります。
権限が追加されたら、ユーザーは、アプリが測位サービスを要求したときに測位サービスが利用できるように権限を付与する必要があります。ユーザーは、「設定」>「プライバシー」>「位置情報サービス」の順にスクロールしてアプリを見つけ、オプションを選択することでこれを変更できます。位置情報サービスを利用するには、位置情報サービスがオンになっている必要があります。
フォアグラウンド位置情報サービス許可の使用
アプリが実行中に位置情報サービスを使用する場合、Info.plistファイルには、NSLocationWhenInUseUsageDescription
というキーと、アプリが位置情報サービスを使用する理由をユーザーに示すテキスト文字列を含む値を持つエントリが必要です。
<key>NSLocationWhenInUseUsageDescription</key> <string>The reason why the app needs location services</string>
バックグラウンド位置情報サービスの使用許可
アプリがバックグラウンドで実行されているときでも位置情報サービスを使用する場合は、NSLocationAlwaysAndWhenInUseUsageDescription
キーと、NSLocationWhenInUseUsageDescription
と同様に理由を文字列で指定したエントリが必要です。
<key>NSLocationWhenInUseUsageDescription</key> <string>The reason why the app needs location services</string> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>The reason why the app needs location services</string>
注: Info.plistファイルは自動的に生成されるため、対策を講じない限り、qmakeやCMakeによって変更が上書きされる可能性があります。詳細はプラットフォームノート - iOSを参照してください。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.