Apple: Detect missing bundle identifier when using location permissions

The location permissions database in /var/db/locationd/clients.plist
ties the location permission to the bundle identifier (among other
things), so a missing bundle identifier will result in the app asking
repeatedly for the location permission, as the permission is never
saved.

Pick-to: 6.5
Change-Id: I64ab5b8f8762804869c0f97debd97da817787808
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-02-02 15:17:56 +01:00
parent 7df8ef0a10
commit ad42833d33

View File

@ -66,6 +66,13 @@ struct PermissionRequest
- (Qt::PermissionStatus)authorizationStatus:(QLocationPermission)permission
{
NSString *bundleIdentifier = NSBundle.mainBundle.bundleIdentifier;
if (!bundleIdentifier || !bundleIdentifier.length) {
qCWarning(lcLocationPermission) << "Missing bundle identifier"
<< "in Info.plist. Can not use location permissions.";
return Qt::PermissionStatus::Denied;
}
switch ([self authorizationStatus]) {
case kCLAuthorizationStatusRestricted:
case kCLAuthorizationStatusDenied: