capawesome-team / capacitor-plugins

āš”ļø Community plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/
227 stars 34 forks source link

bug: Badge.set() not working on iOS #269

Closed wwwguy closed 1 month ago

wwwguy commented 1 month ago

Plugin(s)

Version

6.0.0

Platform(s)

Current behavior

Following the the standard docs, everything works fine on Android but the app icon badge number is not changed on iOS.

Expected behavior

The app icon badge number should change on iOS when Badge.set() is called (and works fine on Android).

Reproduction

https://github.com/wwwguy/cap-badge

Steps to reproduce

  1. From xCode run iOS
  2. Confirm whether the app icon badge is added

Other information

The PrivacyInfo.xcprivacy file was created via xCode per the documentation;

< ?xml version="1.0" encoding="UTF-8"?> < !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> < plist version="1.0"> < dict> < key>NSPrivacyAccessedAPITypes < array> < !-- Add this dict entry to the array if the file already exists. --> < dict> < key>NSPrivacyAccessedAPIType < string>NSPrivacyAccessedAPICategoryUserDefaults < key>NSPrivacyAccessedAPITypeReasons < array> < string>CA92.1 < /array> < /dict> < /array> < /dict> < /plist>

Capacitor doctor

šŸ’Š Capacitor Doctor šŸ’Š

Latest Dependencies:

@capacitor/cli: 6.1.2 @capacitor/core: 6.1.2 @capacitor/android: 6.1.2 @capacitor/ios: 6.1.2

Installed Dependencies:

@capacitor/cli: 6.1.2 @capacitor/android: 6.1.2 @capacitor/core: 6.1.2 @capacitor/ios: 6.1.2

[success] iOS looking great! šŸ‘Œ [success] Android looking great! šŸ‘Œ

Before submitting

robingenz commented 1 month ago

Did you request permissions?

wwwguy commented 1 month ago

Yes, I didn't include it in the repo to simplify things but when we use the following as a precursor to setting the badge value it does not work:

const result = await Badge.checkPermissions().then(async response => { console.log(JSON.stringify(response)); const set = async () => { await Badge.set(5); }; });

It does log that permission was granted:

{"display":"granted"}

But the app icon badge does not display.

robingenz commented 1 month ago

Alright, i need to debug it. Your reproduction does not work. You just added a app.component.ts file without any reference. Please provide a functional Minimal, Reproducible Example using this template in a public GitHub repository.

wwwguy commented 1 month ago

Ok no problem - I have updated the repo - https://github.com/wwwguy/cap-badge

robingenz commented 1 month ago

You are not using the template I provided a link to. Angular is not needed to reproduce the issue, is it?

wwwguy commented 1 month ago

I'm just providing the minimal reproducible example code in use with Ionic Capacitor apps v 6.0. We can remove angular if you want (maybe it will work then?) but just reporting this as it used to work fine in previous versions.

robingenz commented 1 month ago

As i said, please provide a Minimal, Reproducible Example using this template in a public GitHub repository.

wwwguy commented 1 month ago

Thanks anyway... it really does no good to strip it all the way down to such a minimal test environment that it has no reflection on actual use on a live iOS device through Ionic Capacitor w/Angular. We were just trying to help as we've used this plugin for many years and versions of Capacitor without any problems... yet now it no longer works on iOS. All good, we'll find another solution or just build our own. Be well.

robingenz commented 1 month ago

The more code and dependencies your reproducible example has, the longer it will take me to understand and reproduce the problem. It should therefore be in your interest to make it as easy as possible for me to help you. It wouldn't be possible to offer more than 25 plugins for free if I didn't get support from the community. I am closing this issue as no minimal, reproducible example has been provided.