Repository navigation
Conversation
…notifications On iOS 27, showing a notification that only updates the badge fails with error 2002 even though the badge is still applied. The error is now ignored so these calls succeed as they did before. Relates to MaikuB#2838.
Checks for both iOS 27 error codes inline: 2002 for badge-only notifications and 2003 for notifications that aren't authorized. Neither was returned by earlier iOS versions, so this keeps the previous behaviour.
…ding notifications Ignores any error in UNErrorDomain rather than only codes 2002 and 2003, so errors Apple adds in the future are covered too. The iOS 27 section of the readme is updated to match.
There was a problem hiding this comment.
🟡 Changes recommended
Error suppression is too broad and hides authorization and scheduling failures.
2 open findings
What changed in this PR
Updates iOS notification handling for badge-only notifications that return error 2002 on iOS 27.
Changes:
- Suppresses
UNErrorDomainerrors when adding notifications. - Updates iOS 27 guidance.
| File | Description |
|---|---|
README.md |
Documents iOS 27 behavior. |
FlutterLocalNotificationsPlugin.m |
Changes notification error handling. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // iOS 27 returns errors where earlier versions failed silently, | ||
| // such as when notifications aren't authorized, so errors in this | ||
| // domain are ignored | ||
| if (error == nil || [error.domain isEqualToString:UNErrorDomain]) { |
There was a problem hiding this comment.
Can be ignored as the PR description is out of date. @vlaushkin could you update the PR title and description so it matches the change in direction?
There was a problem hiding this comment.
Updated the title and description.
| ``` | ||
|
|
||
| This has been reported on this repository [here](https://github.com/MaikuB/flutter_local_notifications/issues/2838). If you have applications running into this issue, the recommendation is permissions are checked before attempting to show notifications. This is a more intuitive approach that can then be used provide guidance to users on how to grant permissions. Worst case, the `PlatformException` can be caught and dealt with it appropriately but is not the recommended solution. A future release may swallow these at a native level to restore the old behaviour. | ||
| iOS 27 returns errors when a notification can't be saved, for example when permissions haven't been granted, where earlier versions did nothing. The plugin ignores errors in `UNErrorDomain` so showing a notification behaves the same as it did before. Checking permissions before showing notifications is still recommended so users can be guided on how to grant them. This was reported [here](https://github.com/MaikuB/flutter_local_notifications/issues/2838). |
There was a problem hiding this comment.
Updated the readme in 747a495 to also mention badge-only and scheduled notifications.
…cations in the iOS 27 readme section


Relates to #2838.
iOS 27 throws errors where earlier versions didn't: 2003 when notifications aren't authorized, and 2002 for a badge-only
show()(the badge is still applied). This ignores allUNErrorDomainerrors when adding a notification so these calls behave as before, and updates the iOS 27 section of the readme.