Hey everyone,
I've noticed a recent issue in my app where users are not receiving automatic updates/ blank push to the pass added to the user wallet. Instead, they have to manually refresh the pass by dragging down the back of the Apple Wallet to see any updates. This might be because the blank push notification is not updating the passes.
If you've encountered this problem or have any insights into what might be causing it, I'd love to hear from you. Your feedback is invaluable to me.
Notifications
RSS for tagLearn about the technical aspects of notification delivery on device, including notification types, priorities, and notification center management.
Post
Replies
Boosts
Views
Activity
Hi everybody,
I'm trying to implement Firebase messaging into a new iOS app.
I've done everything (add Background Mode and Push Notification capabilities, import my key into FIrebass, ...) as describe in different tutorials that I founded on internet.
The fact is that the console doesn't show me a token..
Does someone has an idea ?
Here's my code :
// pushnotifApp.swift
// pushnotif
//
// Created by Thibault COLLIN on 13/05/2024.
//
import SwiftUI
import FirebaseCore
import FirebaseMessaging
import UserNotifications
class AppDelegate: NSObject, UIApplicationDelegate, MessagingDelegate, UNUserNotificationCenterDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
print("Application did finish launching")
FirebaseApp.configure()
Messaging.messaging().delegate = self
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { (granted, error) in
if granted {
print("Notification authorization granted")
DispatchQueue.main.async {
application.registerForRemoteNotifications()
}
} else {
print("Notification authorization denied")
}
}
return true
}
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
print("Firebase registration token received: \(String(describing: fcmToken))")
}
}
@main
struct pushnotifApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
And the console result :
Application did finish launching
10.26.0 - [FirebaseMessaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
Notification authorization granted
When I run my app in debug mode, whenever a time consuming task is run (like a core data fetch request) there is a time indication appearing on top of the view. I am unable to find the meaning of this and how it is named.
It looks like:
"appName NNNN ms"
(it is not caught by the screen shot)
Can someone tell if it is possible to get rid of it and how ? Thanks for your help !
I am using Pushkit + Callkit and I am facing issue:
I receive incoming call when device is locked screen state then I answer and end call.
The next incoming call will alway display on left corner screen device as below image.
If I receive incoming call when device is unlocked screen state, my application receive, answer call and end call normally.
Hello everyone,
I am developing a feature in my app where, upon receiving a push notification, the app should open automatically if it is closed and the screen is locked. If the device is unlocked, a persistent notification should appear and only be removed with user interaction.
We managed to implement this functionality on Android using some configurations and additional rules. With this, upon receiving a push notification, the app opens automatically or a permanent notification appears.
I would like to know how I can implement this functionality on iOS using Swift. Is there any specific configuration or API that allows the app to open automatically upon receiving a push notification or to display a persistent notification on the unlocked screen?
Thanks in advance for your help!
Im using server V5.8 in Mojave that has worked so well until last week that I cannot entoll new devices or push apps to pupils iPads. I have tried everything even reenrolling devices but still no communication from the mobile device management server to the iPads. Please help as I have 50 new iPads for a new class that I need to enrol.
We are attempting to enable provisional notifications in our app, but some internal users on iOS 17 are reporting that they are not receiving the "Keep" and "Turn off" buttons that provisional notifications are supposed to have - in other words they just come in as regular quiet notifications.
I have confirmed that these users are doing a fresh install of our app, and at no point are they ever receiving a permission prompt to turn on notifications. Their UNAuthorizationStatus is correctly being set to provisional. Their notification settings are being set to the following, which seems correct:
I have not been able to reproduce this issue on any of my own devices, but these users can do so consistently. What could possibly cause this? Some misconfiguration on our end, our some hidden iOS setting somewhere?
Hi, I am trying to add in a push notification but the send push notifications function does not seem to be working. Can someone help?
func sendNotification() {
print("Bluetooth device disconnected. Sending notification.")
let content = UNMutableNotificationContent()
content.title = "Car Disconnected"
content.body = "Please key in where you have left your car"
content.sound = UNNotificationSound.default
// Create a trigger to send the notification immediately
let request = UNNotificationRequest(identifier: "BluetoothDisconnected", content: content, trigger: nil)
UNUserNotificationCenter.current().add(request) { error in
if let error = error {
print("Error adding notification request: \(error.localizedDescription)")
} else {
print("Notification request added successfully.")
}
}
}
I have a question regarding the Live Activities feature introduced in iOS 16.1.
According to the documentation, Live Activities can be updated via push notifications. However, I am curious to know if Live Activities can still receive updates via push notifications when push notification permissions are turned off for an app.
Could you please clarify whether Live Activities updates are independent of the push notification permissions setting, and if so, how the update mechanism works in this scenario?
Thank you for your assistance.
Best regards,
MDM ActivationLockRequest 错误 405,如何解决这个问题,Please advise.谢谢
Is the Apple Push Notification Service FedRamp compliant?
Hello all.
I've been asked to add data push notifications to an iOS app, and that is working good.
It must be a data push as my banner must show user icon, not app icon (like WhatsApp and Telegram).
So the notification banner is showing, until the app is opened or it's been closed less than 2 days (more or less) ago.
After (about) 2 days, the push banner is not displayed anymore.
Did never had this problem when I was using "normal" notifications.
BTW, the banner is displayed as I open the app.
Any thoughts?
"Remote notifications" background mode is already activated.
I'm using Firebase Cloud Messaging, if it can help. application:didReceiveRemoteNotification:fetchCompletionHandler is implemented.
Push msg has
"aps": {
"content-available": 1
},
in the correct place.
Thank you
Hey there,
i implemented live activity in my app and iam trying to start the live activity from push notification, updates works fine even when the app is in background but starting the activity creating issue mostly on background and kill mode when i check the delivery of live activity on cloudkit console it says stored for device power considerations.
anyone having the same issue ?
I have a native SwiftUI Mac app which is based off my iOS app and includes Core Data with iCloud sync. As per my understanding, when a user makes a change on one of the devices a remote notification is sent to the others. I have a widget which displays information from Core Data and the remote notification makes the widget update its information on the next timeline refresh without the user having to open the app manually.
My question is, if an app is closed on macOS so it's not even running in the Dock, do remote notifications work? This page says "the delegate receives this message when the application is running and a remote notification arrives for it". Does that mean the app won't receive remote CloudKit notifications when closed on macOS?
I am getting Forbidden message when i try to send push notification to iphone
Delivery issues with push notifications can usually be determined by examining the responses from APNs.
APNs will return useful information both in the HTTP/2 header response, and as a JSON dictionary for unsuccessful requests. You can find the list of responses, and further troubleshooting steps in the article Handling Notification Responses from APNs:
If the above document does not help clarify the issue, or issues with receiving notifications persist despite receiving an error status neither in the HTTP/2 headers nor in the response JSON dictionary, we may be able to assist you with diagnosing the issue.
If you are using a third-party push notification provider service, we recommend to contact them first to make sure the issue is not between your app and their service, and to obtain information on any errors they might be receiving from Apple servers.
To help diagnose the issue, we will need some information about the push requests. Please include the following information in your post, for a failed or delayed notification that has been attempted within the last 48 hours:
The following are required to start a diagnosis:
Exact time and date (including time zone) of the push request sent
Exact time and date (including time zone) of the notification received by the device (if received at all)
Your app’s Bundle ID
The token the push was sent to
The returned (error) status and message from APNs
Full contents of the HTTP/2 headers
Full contents of the payload
The following are helpful for timely and accurate diagnosis of the issue:
If using your own server to send: the public IPv4 address of the push provider server used to send the push
If using a third-party service to send: the name of the third-party push provider service used
The push topic (apns-topic header value)
The push type (alert, background, VoIP, other)
The apns-id (either set in your request, or received from the HTTP/2 header response)
Any logging you have from the server side that shows the interaction with it and APNs
If you are using a third-party push provider service, and do not have the above necessary info, or only have the info you are providing to the service, please first contact the service provider for a resolution or to give you the above specific information.
When posting about an issue you are having with sending/receiving push notifications, include the above required information and as much of the secondary helpful information you can collect with your post in an organized manner for us to be able to help with diagnosing the issues.
Hey Team,
We're experiencing an issue where push notifications are failing to deliver to certain devices in the production environment. However, they are working fine in the development build on specific devices. Interestingly, the notifications are working fine for a few devices in the same production environment.
In the affected devices we have attempted the following things to resolve the issue
Verify the device token (& send the notification through apple push notification console)
reinstall the application
reboot the device
Below are the device details
Model - Macbook Pro 15-inch, 2018
processor - 2.9 GHz 6-Core Intel Core i9
OS Version - macOS Sonoma 14.2.1
I have attached the APSD process console log for the affected device. In which we are getting following error.
apsd Peer connection [pid=472] lacks APSConnectionInitiateEntitlement
APSD_ConsoleLog.txt
Thank you all in advance for any information regarding this issue and we will provide any additional information if needed.
Here is the code:
let pushRegistry = PKPushRegistry(queue: .main)
func applicationDidFinishLaunching() {
pushRegistry.delegate = self
pushRegistry.desiredPushTypes = [.complication]
}
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
let token = pushCredentials.token.reduce("") { $0 + String(format: "%02x", $1) }
print(token)
}
The watch extension has push notifications capability, and the delegate is never called with the pushCredentials.
Setup and status:
The app is under an Enterprise dev account.
The app has Push Notifications, Remote Notifications and Voice over IP entitlements selected, among other, unrelated (I think) items.
On launch, the app successfully registers via PushKit and gets back a valid device token.
This token is copied from the Xcode console, and used to send VOIP pushes via the iCloud push console: https://developer.apple.com/notifications/push-notifications-console/
Results:
For a debug build loaded onto a physical device, the push console reports successful delivery of the VOIP push to the device. However, VOIP pushes are only received by the app when it is in the foreground. If the app is in the background or not running, it is not woken/launched.
The docs mention the need for a special VOIP push certificate, but my understanding is that is required between my server and Apple's servers. Since I am using the push console, I assume that removes the need for the certificate.
So, what am I missing?
Hi,
I have a question regarding the badge in push notifications. I am implementing the following code to set the badge to 0 in order to remove it from the app:
swift
if #available(iOS 16, *) {
let center = UNUserNotificationCenter.current()
center.setBadgeCount(0)
} else {
application.applicationIconBadgeNumber = 0
}
When I call setBadgeCount(0), the badge disappears, but the notifications in the Notification Center remain. On the other hand, when I call application.applicationIconBadgeNumber = 0, the badge disappears and all notifications in the Notification Center are cleared. Additionally, if no badge is displayed, calling application.applicationIconBadgeNumber = 0 does not clear the notifications in the Notification Center.
Is this behavior expected?
If it is expected, is there a way to call setBadgeCount(0) and clear all notifications in the Notification Center? Also, is there a way to call application.applicationIconBadgeNumber = 0 without clearing the notifications in the Notification Center?