# iOS 通知在用户活跃时可能失去推送权限

**URL:** <https://meta.discourse.org/t/ios-notifications-can-lose-permission-to-push-if-the-user-is-currently-active/290225>\
**Category:** Bug\
**Created:** [2024 年1 月 1 日 23:35 UTC](https://meta.discourse.org/t/ios-notifications-can-lose-permission-to-push-if-the-user-is-currently-active/290225 "2024-01-01T23:35:49Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

作者： ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
发布日期： [2024 年1 月 3 日 00:31 UTC](https://meta.discourse.org/t/ios-notifications-can-lose-permission-to-push-if-the-user-is-currently-active/290225/7 "2024-01-03T00:31:31Z")

</div>

好的，我有一个关于此的 PR。

@Falco / @featheredtoast 我们应该合并它吗？

> <https://github.com/discourse/discourse/pull/25099>
>
> According to Apple, silent push notifications are automatically punished per:
> 
> h…ttps://developer.apple.com/videos/play/wwdc2022/10098/?time=814
> 
> \> As mentioned when I showed you the code on how to request a push
> \> subscription, you must promise that pushes will be user visible.
> \> Handling a push event is not an invitation for your JavaScript to
> \> get silent background runtime. Doing so would violate both a user’s
> \> trust and a user’s battery life. When handling a push event, you are
> \> in fact required to post a notification to Notification Center.
> \> Other browsers all have countermeasures against violating the promise
> \> to make pushes user visible, and so does Safari.
> \> In the beta build of macOS Ventura, after three push events where you
> \> fail to post a notification in a timely manner, your site’s push
> \> subscription will be revoked. You will need to go through the permission
> \> workflow again.
> 
> The isIdle check was causing certain push notifications to be silent
> 
> Additionally, the auto dismissal logic was causing delays which may cause
> the device to think the push was a silent one.
> 
> By removing this we hope to ensure push notification delivery is more robust
> and consistent on iOS.

如果我们必须跳过推送通知，我们必须在服务器上而不是在客户端上进行。折叠逻辑一直有些可疑，应用程序通常不会这样做。

---

_[View the full topic](https://meta.discourse.org/t/ios-notifications-can-lose-permission-to-push-if-the-user-is-currently-active/290225)._
