Permissions (iOS)
1) Info.plist keys
Add clear user-facing copy for:
NSLocationWhenInUseUsageDescriptionNSLocationAlwaysAndWhenInUseUsageDescriptionNSLocationAlwaysUsageDescription
2) Background modes
Enable in Signing & Capabilities:
Background Modes > Location updatesBackground Modes > Remote notifications
3) Request runtime permissions
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, _ in
if granted {
DispatchQueue.main.async { UIApplication.shared.registerForRemoteNotifications() }
}
}
BubblPlugin.shared.requestLocationWhenInUse()
BubblPlugin.shared.requestLocationAlways()
4) Observe permission state in app UI
.onReceive(BubblPlugin.locationAuthorizationPublisher) { status in
// update UI
}
.onReceive(BubblPlugin.pushAuthorizationPublisher) { status in
// update UI
}
5) Permission sequencing recommendation
- Explain value first
- Ask for push
- Ask for location when-in-use
- Ask for always location