簡體   English   中英

iOS是否會限制計划的本地推送通知?

[英]Does iOS throttle scheduled local push notifications?

我的應用程序通過FCM接收靜默推送通知 ,正如我在日志記錄中看到的那樣,已接收並處理了通知 然后,我的應用程序所做的就是確定是否向用戶顯示通知的某種邏輯。 這有時有效,有時卻無效。 在我看來,它好像先工作然后突然停止工作,所以我猜測是否可能是一個節流的問題?

我確實安排了30秒間隔5條通知-因此用戶不會錯過通知:

    for i in 0...5 {
        let notification = UNMutableNotificationContent()
        notification.title = NSLocalizedString("bed_wet", comment: "")
        notification.subtitle = device.lookAfterPatientString
        notification.sound = UNNotificationSound(named: "alarm.mp3")
        notification.categoryIdentifier = Notification.Category.alarm
        notification.userInfo = ["identifier": device.id]

        let timeInterval = max(1, delaySeconds) + i * 30
        let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: TimeInterval(timeInterval), repeats: false)
        let request = UNNotificationRequest(identifier: UUID.init().uuidString, content: notification, trigger: notificationTrigger)

        UNUserNotificationCenter.current().add(request) { error in
            ...
        }
    }

這個循環會是問題嗎?

嘗試使用dispatch_async進行嘗試,可能會調用一些不會阻塞主線程的代碼,有時還會不調用。

第二個問題可能是iOS的邏輯阻止了應用向手機發送垃圾郵件。 您是否看到過instagram通知從幾百個通知限制到只有幾個通知。

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM