I am trying to do troubleshooting on a messaging application forked by signal. In general, the application works well for all users, so my issue is limited to few of them.
THE ISSUE: These users, do not receive notifications if the application is killed, killed, not in background. When they start the application, notifications arrives.
I tried the basic troubleshooting:
- reset network settings
- deletion and reinstallation of the app.
- the network to which you are connected does not seem to affect.
- different iPhones, identical operating system, have different behaviors.
- other apps on the phone do not have the issue.
- no double (virtual) sim is present.
- on the phone there is an MDM profile (citrix), but my app in question is not on the store, and the profile itself does not “administer” the phone, is it only present to download certain apps (I mean, no one is filtering push notifications)
What other could be the functions or settings that could create such behavior? I'm starting to think that something in the firmware of the components of the iPhone itself may have to do with the problem. Is anyone aware of any problems that could involve the APNS/server dialogue? Even some hint could help.
more info: we are using this entitlement
com.apple.developer.usernotifications.filtering
it was involved in order for NSE to be working. here the relative function. I'm aware that this entitlement could "hide" local notifications (this is what it seems to me). but the behavior is not clear to me.
this is the implementation
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
// This should be the first thing we do.
environment.ensureAppContext()
// Detect and handle "no GRDB file" and "no keychain access; device
// not yet unlocked for first time" cases _before_ calling
// setupIfNecessary().
if let errorContent = NSEEnvironment.verifyDBKeysAvailable() {
if hasShownFirstUnlockError.tryToSetFlag() {
NSLog("DB Keys not accessible; showing error.")
contentHandler(errorContent)
} else {
// Only show a single error if we receive multiple pushes
// before first device unlock.
NSLog("DB Keys not accessible; completing silently.")
let emptyContent = UNMutableNotificationContent()
contentHandler(emptyContent)
}
return
}
if let errorContent = environment.setupIfNecessary() {
// This should not occur; see above. If we've reached this
// point, the NSEEnvironment.isSetup flag is already set,
// but the environment has _not_ been setup successfully.
// We need to terminate the NSE to return to a good state.
Logger.warn("Posting error notification and skipping processing.")
Logger.flush()
contentHandler(errorContent)
fatalError("Posting error notification and skipping processing.")
}
self.contentHandler.set(contentHandler)
owsAssertDebug(FeatureFlags.notificationServiceExtension)
let nseCount = Self.nseDidStart()
//let SP = SpikAD_Play()
//SP.checkPlay()
Logger.error("Received notification in class: \(self), thread: \(Thread.current), pid: \(ProcessInfo.processInfo.processIdentifier), nseCount: \(nseCount)")
AppReadiness.runNowOrWhenAppDidBecomeReadySync {
environment.askMainAppToHandleReceipt { [weak self] mainAppHandledReceipt in
guard !mainAppHandledReceipt else {
Logger.error("Received notification handled by main application, memoryUsage: \(LocalDevice.memoryUsageString).")
self?.completeSilenty()
return
}
Logger.error("Processing received notification, memoryUsage: \(LocalDevice.memoryUsageString).")
self?.fetchAndProcessMessages()
}
}
}