Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid permission for REMOTE_NOTIFICATION on iOS #61

Open
ncltg opened this issue Sep 21, 2022 · 4 comments
Open

Invalid permission for REMOTE_NOTIFICATION on iOS #61

ncltg opened this issue Sep 21, 2022 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@ncltg
Copy link

ncltg commented Sep 21, 2022

The issue

When calling permissionsController.getPermissionState() with Permission.REMOTE_NOTIFICATION, I always get the same value : DeniedAlways.

I'm testing it by deleting completely my app for my test phone.
At the time the call is made no authorization has been requested by the user yet.
In fact, just to be sure I also checked into the settings of the app that the Notification setting row does not appear.

What I tested

I first tested to prompt the notification status by logging it in my iOS app that way :

    let currentCenter = UNUserNotificationCenter.current()
    currentCenter.getNotificationSettings { value in
      print(value.authorizationStatus)
    }

Which gives me this output :

<UNNotificationSettings: 0x28002ac70; authorizationStatus: NotDetermined, notificationCenterSetting: NotSupported, soundSetting: NotSupported, badgeSetting: NotSupported, lockScreenSetting: NotSupported, carPlaySetting: NotSupported, announcementSetting: NotSupported, criticalAlertSetting: NotSupported, timeSensitiveSetting: NotSupported, alertSetting: NotSupported, scheduledDeliverySetting: NotSupported, directMessagesSetting: NotSupported, alertStyle: None, groupingSetting: Default providesAppNotificationSettings: No>

Everything is fine here so I moved on with trying to get the value myself from my KMM/iosMain code :

    fun getPermissionState() {
        val currentCenter = UNUserNotificationCenter.currentNotificationCenter()
        currentCenter.getNotificationSettingsWithCompletionHandler { settings: UNNotificationSettings? ->
            Log.debug(settings?.authorizationStatus.toString()) // returns 0 for UNAuthorizationStatus.notDetermined
        }
    }

I get the right result even in the kmm side, while at the same time I still get .DeniedAlways from moko.permissions

Any idea where this issue could originate from ?

@petarmarijanovicfive
Copy link

+1! There are multiple issues with iOS Remote notifications, which makes this library for Kotlin Mobile development useless.

@Alex009 we've just merged the Android support for Remote notifications. Can we do the same for iOS as well 😁

@Alex009
Copy link
Member

Alex009 commented Dec 18, 2022

@petarmarijanovicfive you can create PR with fixes.
i think now we not have case NotDetermined just because android can't tell us same state

@Alex009 Alex009 added the bug Something isn't working label Apr 9, 2023
@Alex009 Alex009 added this to the 0.14.1 milestone Apr 9, 2023
@Alex009 Alex009 self-assigned this Apr 9, 2023
@Alex009
Copy link
Member

Alex009 commented Apr 10, 2023

i check now on 0.15.0 dev version and i see that getPermissionState return NotDetermined on iOS on clean install
image

@Alex009
Copy link
Member

Alex009 commented Apr 10, 2023

DeniedAlways will be after trying to request permission and user decline this request

@Alex009 Alex009 removed this from the 0.15.0 milestone Apr 10, 2023
@Alex009 Alex009 added question Further information is requested and removed bug Something isn't working labels Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants