Skip to content

[Bug]: RequestPermission not working without given consent on iOS #1056

@gianlucaschoefer

Description

@gianlucaschoefer

What happened?

When calling ...requestPermission(true) after having set ...consentRequired(true); and initialised the SDK, nothing happens on iOS. In a variant of the bug where the requestPermission is called immediately after initialisation, the App gets stuck.

Steps to reproduce?

1. Install version 5.3.4
2. Call `OneSignal.consentRequired(true)`,
3. Call `OneSignal.initialize(ID)`
4. Call `OneSignal.Notifications.requestPermission(true)`
5. Nothing happens.

What did you expect to happen?

I expected the native iOS notification permission request to appear, as it does on Android or when calling await OneSignal.consentGiven(true) between reproduction steps 3. and 4. (which we want to do at a later point).

The logs seem to indicate this might be expected behaviour, but it is unclear then 1. why it works on Android, 2. why the local notification permission is affected by the privacy consent.

OneSignal Flutter SDK version

Release 5.3.4
Flutter: 3.32.5

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

VERBOSE: Delayed initialization of the OneSignal SDK until the user provides privacy consent using the setPrivacyConsent() method
WARNING: Your application has called pushSubscription.token before app ID has been set. Please call `initialize:appId withLaunchOptions:launchOptions` in order to set the app ID
WARNING: Your application has called pushSubscription.token before the user granted privacy permission. Please call `consentGranted(bool)` in order to provide user privacy consent
WARNING: Your application has called pushSubscription.id before app ID has been set. Please call `initialize:appId withLaunchOptions:launchOptions` in order to set the app ID
WARNING: Your application has called pushSubscription.id before the user granted privacy permission. Please call `consentGranted(bool)` in order to provide user privacy consent

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions