Hello,
I have been implementing NEAppPushProvider class to establish my own protocol to directly communicate with our provider server without the need to rely on APNs for background push notifications.
I am at a stage where I am able to establish a tcp communicator and receive messages back and forth but I noticed that when I disconnect from the WIFI I've set up by setting a given SSID, I am not getting hit on the Stop method. Below is briefly how I load and save preferences.
NEAppPushManager appPushManager = new NEAppPushManager();
appPushManager.LoadFromPreferences((error) =>
{
if (error != null)
{
Console.WriteLine($"Error loading NEAppPushManager preferences: {error.LocalizedDescription}");
return;
}
if (!enable)
{
Console.WriteLine("Disabling Local Push Provider...");
appPushManager.Enabled = false;
// ✅ Immediately update UserDefaults before saving preferences
userDefaults.SetBool(false, Constants.IsLocalPushEnabled);
userDefaults.Synchronize();
appPushManager.SaveToPreferences((saveError) =>
{
if (saveError != null)
{
Console.WriteLine($"Error disabling Local Push: {saveError.LocalizedDescription}");
}
else
{
Console.WriteLine("Local Push successfully disabled.");
}
});
return;
}
// ✅ Now we can safely enable Local Push
Console.WriteLine($"Enabling Local Push for SSID: {_currentSSID}");
appPushManager.MatchSsids = new string[] { _currentSSID };
appPushManager.LocalizedDescription = "LocalPushProvider";
appPushManager.ProviderBundleIdentifier = Constants.LocalPushExtensionBundleId;
appPushManager.Enabled = true;
appPushManager.SaveToPreferences((saveError) =>
{
if (saveError != null)
{
Console.WriteLine($"Error saving Local Push settings: {saveError.LocalizedDescription}");
}
else
{
Console.WriteLine("✅ Local Push successfully registered.");
userDefaults.SetBool(true, Constants.IsLocalPushEnabled);
userDefaults.Synchronize();
}
});
});
I've read through documentation and was expecting the Stop method to be hit when I turn off Wifi. Am I missing anything? Please let me know if I should provide more info. Currently I just have a console writeline method inside the Stop method to see if it actually gets hit.
User Notifications
RSS for tagPush user-facing notifications to the user's device from a server or generate them locally from your app using User Notifications.
Posts under User Notifications tag
147 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello Everyone,
We have some doubts regarding the apple notification alert update received in Oct 2024 for APNS server certificate update.
Does this change is already live for sandbox environment?
As we have checked on sandbox environment without changing any certificate its working and we are able to get push notification.
Does that means our system does not need any change for production as well?
If required where we should add https://www.sectigo.com/knowledge-base/detail/Sectigo-Intermediate-Certificates/kA01N000000rfBO. This certificate.
For FYI we are using python library called django-push-notifications which internally call to the APNS server for push notifications.
Do we need this new certificate "SHA-2 Root : USERTrust RSA Certification Authority certificate" if we are using token based authentication with APNs? We are signing the JWT with the private Auth key?
Or is the new certificate needed on top of this?
We are doing something like this:
Dictionary<string, object> payload = new Dictionary<string, object>()
{
{ "iss", teamId }, // Apple Developer Team ID
{ "iat", unixTimestamp } // Issued-at time
};
Dictionary<string, object> header = new Dictionary<string, object>()
{
{ "alg", "ES256" },
{ "kid", keyId } // Key ID from Apple Developer portal
};
string token = JWT.Encode(payload, privateKey, JwsAlgorithm.ES256, header);
Hello ,
We are trying MDM APNs push using following command
curl.exe -X POST --http2 -k -v --cert PushCert.pem --cacert cacert.pem https://api.push.apple.com/3/device/9BFDFB46D48159D16E5DC80391B765EE99524CF294BB4BF9FB5AEA7A5F3FFD79 -d "{"mdm":"84F0C145-5963-4F06-9D11-DFBDB45802D5"}" -H "apns-topic: com.apple.mgmt.External.c217c1bf-ad51-42a9-9108-2e92ef705b2a" -H "apns-push-type: mdm"
The command process correctly there is no error but device doesn't receive the Apns push.
At the same time the older device recives the Apns push but newer device not.
What can be the cause,how to debug this issue.
Hi,
I'm working on an IOS app using capacitor. I'm trying to receive push notifications on my downloaded app from testflight. I tried with FCM and it's working on my android app but not on ios and the logs show no error.
This is how I retreive the FCM token:
const fcmToken = await FCM.getToken()
sendSubscriptionToBackEnd({
fcm_token: fcmToken.token,
device: platform
})
Then I have a job on my backend to send the push notifications:
def perform
fcm = FCM.new(
StringIO.new(Rails.application.credentials.google_application_credentials),
Rails.application.credentials.firebase_project_id
)
NotificationSubscription.find_each(batch_size: 100) do |subscription|
begin
response = fcm.send_v1({
token: subscription.fcm_token,
notification: {
title: 'Un nouveau signal a été publié',
body: 'Un nouveau signal a été publié, cliquez ici pour le voir'
},
android: {
priority: 'high'
},
apns: {
payload: {
aps: {
# alert: {
# title: 'Un nouveau signal a été publié',
# body: 'Un nouveau signal a été publié, cliquez ici pour le voir'
# },
sound: 'default'
}
},
headers: {
"apns-priority": "10",
"apns-push-type": "alert"
}
}
})
if response[:status_code] == 200
Rails.logger.info "Notification sent successfully to #{subscription.id} on device #{subscription.device}"
else
Rails.logger.error "Failed to send notification to #{subscription.id} body: #{response[:body]}"
# subscription.destroy
end
rescue StandardError => e
Rails.logger.error "Error while sending notification to #{subscription.device}: #{e.message}"
subscription.destroy
end
end
end
and the logs show that it's successful but i dont receive the notification. When I test from firebase console I receive the push notification on both ios and android capacitor apps. I also added this in the apple delegate:
Messaging.messaging().apnsToken = deviceToken
Messaging.messaging().token(completion: { (token, error) in
if let error = error {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
} else if let token = token {
NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: token)
}
})
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
}
I also tried using apns tokens and ther apnotic gem:
console.log('APNs Token:', token.value)
if (platform === 'ios') {
sendSubscriptionToBackEnd({
apns_token: token.value,
device: platform
}).then(() => {
displaySnackbar(`APNs token: ${token.value}`, 'success')
})
}
})
# Create the APNs connection outside the loop
connection = Apnotic::Connection.new(
auth_method: :token,
cert_path: StringIO.new(Rails.application.credentials.apns_key_path),
key_id: Rails.application.credentials.apn_key_id,
team_id: Rails.application.credentials.apple_team_id
)
NotificationSubscription.find_each(batch_size: 100) do |subscription|
if subscription.device == 'ios'
begin
# Create the notification for the current device token
notification = Apnotic::Notification.new(subscription.apns_token)
notification.alert = "Un nouveau signal a été publié"
notification.topic = Rails.application.credentials.apple_bundle_id
# Prepare and send the push
push = connection.prepare_push(notification)
push.on(:response) do |response|
if response.ok?
Rails.logger.info "Notification sent successfully to #{subscription.id} on device #{subscription.device}"
else
Rails.logger.error "Failed to send notification to #{subscription.id} body: #{response.status} - #{response.body}"
end
end
connection.push_async(push)
rescue StandardError => e
Rails.logger.error "Error while sending notification to #{subscription.device}: #{e.message}"
subscription.destroy
end
end
end
connection.join(timeout: 5)
connection.close
end
but i have a bad token error:
Failed to send notification to 223 body: 400 - {"reason"=>"BadDeviceToken"}
I, [2025-01-23T02:23:59.013407 #104] INFO -- : [ActiveJob] [ApnsNotificationJob]
I checked my aps entitlement env and its production, have all the certificates, keys.. so I dont understand why i can receive push notifications from firebase console but not from my app
I'm having an issue on my standalone watchOS app where the settings to adjust notifications does not appear anywhere on the iPhone or the Watch. I have successfully requested notifications access from the user and have successfully displayed a local notification to them. However, if the user ever decides to revoke my notification access (or if they deny originally and want to change), the settings pane for notifications does not appear anywhere.
I've looked in the following places:
On the watch in Settings > Notifications, however it looks like you can no longer edit per app notification settings directly on the watch (none of the installed apps on my watch appear in here). The only options are settings like "tap to show full notification" and "announce notifications" which affect all notifications (Why not? Especially for apps that don't have a iPhone companion app?).
On the iPhone in the Watch app (the app you set up your watch in), in Watch > Notification. My app does not appear anywhere in there.
On the iPhone in the iPhone Settings app, in Settings > Notifications. My app does not appear anywhere in there.
On the iPhone in the iPhone Settings app, in Settings > Apps. My app does not appear anywhere in there
I've tried:
Adding capabilities in Signing & Capabilities for Push Notification, Time-Sensitive Notifications and Communication Notifications
Building the app for release instead of debug
My app also requires location access and has successfully appeared in the settings pane directly on the watch in Settings > Privacy & Security > Location Services, however notification settings do not appear anywhere.
I have created a stripped down test app to try and that also does not work. This test code successfully asks the user for permission and (from a button in ContentView), successfully schedules a notification and displays it to the user when they're not in the app. Here's the code for my NotificationManager:
import UserNotifications
class NotificationManager: NSObject, ObservableObject, UNUserNotificationCenterDelegate {
static let shared = NotificationManager()
@Published var hasAuthorisation = false
private override init() {
super.init()
UNUserNotificationCenter.current().delegate = self
requestAuthorisation()
}
func requestAuthorisation() {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { authorised, error in
DispatchQueue.main.async {
if let error = error {
print("Error requesting notifications: \(error.localizedDescription)")
}
self.hasAuthorisation = authorised
}
}
}
func scheduleNotification(title: String, body: String, timeInterval: TimeInterval) {
let content = UNMutableNotificationContent()
content.title = title
content.body = body
content.sound = .default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: timeInterval, repeats: false)
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request) { error in
if let error = error {
print("Error scheduling notification: \(error.localizedDescription)")
} else {
print("Notification scheduled successfully.")
}
}
}
}
This issue has persisted across two iPhones (recently upgraded) and the watch was wiped when connecting to the new iPhone.
Am I missing some code? Am I missing some flag I need to set in my project somewhere? Please can someone with an Apple Watch try this code in a standalone watchOS app and see if the notifications pane appears anywhere for them? I've contacted Apple DTS, but they're taking a while to respond.
I am developing an application that uses NetworkExtension (Local PUSH function) And VoIP(APNs) PUSH.
Nowadays, I found a problem on this app doesn't handle incoming call of Local PUSH when receiving a Local PUSH after receiving an APNs PUSH.
My confimation result of my app and server log is below.
11:00 AM:
my server(PBX) requests a VoIP(APNs) PUSH notification to the APNs.
But my app does not receive the VoIP(APNs) PUSH.
At this time, my app is running on LAN (Wi-Fi without internet connection), as a result, NetworkExtension was running. so I think this is normal behaviour.
14:55:11 PM:
There is an incoming call from the my server(PBX) via local net, and NetworkExtension calls iOS API(API name is reportIncomingCall).
However, iOS does not call the delegate didReceiveIncomingCallWithUserInfo for the reportIncomingCall.
14:55:11 PM:
At almost the same time, iOS calls the delegate cdidReceiveIncomingPushWithPayload of VoIP PUSH.
(instead of call the delegate didReceiveIncomingCallWithUserInfo for the reportIncomingCall?)
And the content of this VoIP(APNs) PUSH was the incoming call at "11:00 AM".
In other words, the VoIP(APNs) PUSH at 11:00 AM is stuck inside iOS, and at 14:55:11 PM, from NetworkExtension reports it.
I feel there is a problem on iOS doesn't handle incoming call of Local PUSH when receiving a Local PUSH after receiving an VoIP(APNs) PUSH.
Would you tell me Apple's opioion about this?
If this is known problem, Please tell me about it.
I tried below at 2:00 PM on 21/01/2025(JST).
Apple Push Notification service server certificate update
I followed above,
a new server certificate: "SHA-2 Root : USERTrust RSA Certification Authority certificate" was added to my push server, but a certificate error occurred and push notifications could not be sent.
So I refered this article,Instead of connecting via DNS name resolution at api.development.push.apple.com,
I fixed api.development.push.apple.com to "17.188.143.34" in /etc/hosts,
I could push notifications with the new server certificate.
(I got this IP(17.188.143.34) from this airtcle)
From this, I suspect that Apple had not yet updated the APNs certificate (CA) for the Sandbox environment as of 2:00 PM on January 21, 2025 (JST).
Was the update published as scheduled?
Problem
We have successfully set up push notifications using Apple APN service, that is push notifications work when using a token generated using the JSON Web Token Generator in the Push Notification console. However, we get an "InvalidProviderToken" error when creating using our own token using the following code.
The Key and TeamID is definitely correct (obviously, censored in the below code). When pasting our token in the JSON Web Token Validator in the Push Notification console we get the error „Invalid signing key“. We merely pasted our secret key in our setNewTokenIfNeeded code, separated on four lines using the “““ style.
Does anyone know why this error happens? Given that it works when we upload our .p8 file to the JSON Web Token Generator and we simply paste the text of this file (excluding the lines with "-----BEGIN/END PRIVATE KEY-----") I guess our secret key is correct?
Code to generate token
fileprivate var currentToken: String?
fileprivate var currentTokenCreateTime: Date?
fileprivate func setNewTokenIfNeeded() {
// Ensure, token is at least 20 minutes but at most 60 minutes old
if let currentTokenCreateTime = currentTokenCreateTime {
let ageOfTokenInSeconds = abs(Int(currentTokenCreateTime.timeIntervalSinceNow))
NSLog("Age of token: \(Int(ageOfTokenInSeconds / 60)) minutes.")
if ageOfTokenInSeconds <= 20 * 60 { return }
}
// Generate new token
NSLog("Renewing token.")
let secret = """
ABCABCABCABCABCABCABCABCABCABCABCABC+ABCABC+ABCABCABC+ABCABCAB/+
ABCABCABCABCABCABCABCABCABCABCABCABC+ABCABC+ABCABCABC+ABCABCAB/+
ABCABCABCABCABCABCABCABCABCABCABCABC+ABCABC+ABCABCABC+ABCABCAB/+
ABCABCAB
"""
let privateKey = SymmetricKey(data: Data(secret.utf8))
let headerJSONData = try! JSONEncoder().encode(Header())
let headerBase64String = headerJSONData.urlSafeBase64EncodedString()
let payloadJSONData = try! JSONEncoder().encode(Payload())
let payloadBase64String = payloadJSONData.urlSafeBase64EncodedString()
let toSign = Data((headerBase64String + "." + payloadBase64String).utf8)
let signature = HMAC<SHA256>.authenticationCode(for: toSign, using: privateKey)
let signatureBase64String = Data(signature).urlSafeBase64EncodedString()
let token = [headerBase64String, payloadBase64String, signatureBase64String].joined(separator: ".")
currentToken = token
currentTokenCreateTime = Date()
}
fileprivate struct Header: Encodable {
let alg = "ES256"
let kid: String = "ABCABCABC" // Key (censored here)
}
fileprivate struct Payload: Encodable {
let iss: String = "ABCABCABC" // Team-ID (censored here)
let iat: Int = Int(Date().timeIntervalSince1970)
}
extension Data {
func urlSafeBase64EncodedString() -> String {
return base64EncodedString()
.replacingOccurrences(of: "+", with: "-")
.replacingOccurrences(of: "/", with: "_")
.replacingOccurrences(of: "=", with: "")
}
}
Code to send the push notification
func SendPushNotification(category: ConversationCategory,
conversationID: UUID,
title: String,
subTitle: String?,
body: String,
devicesToSendTo: [String]) {
// Für alle Felder s. https://developer.apple.com/documentation/usernotifications/generating-a-remote-notification
let payload = [
"aps": [
"alert": [
"title": title,
"subtitle" : subTitle ?? "",
"body": body
],
"category" : category.rawValue,
"mutable-content": 1
],
"conversationID": conversationID.uuidString
] as [String : Any]
// Ggf. Token setzen
setNewTokenIfNeeded()
guard let currentToken = currentToken else {
NSLog("Token not initialized.")
return
}
NSLog(currentToken)
// Notification an alle angegebenen Devices schicken
let bundleID = "com.TEAMID.APPNAME"
for curDeviceID in devicesToSendTo {
NSLog("Sending push notification to device with ID \(curDeviceID).")
let apnServerURL = "https://api.sandbox.push.apple.com:443/3/device/\(curDeviceID)"
var request = URLRequest(url: URL(string: apnServerURL)!)
request.httpMethod = "POST"
request.allHTTPHeaderFields = [
"authorization": "bearer " + currentToken,
"apns-id": UUID().uuidString,
"apns-topic": bundleID,
"apns-priority": "10",
"apns-expiration": "0"
]
request.httpBody = try! JSONSerialization.data(withJSONObject: payload, options: .prettyPrinted)
URLSession(configuration: .ephemeral).dataTask(with: request) { data, response, error in
if let error = error {
NSLog(error.localizedDescription)
}
if let data = data {
NSLog(String(data: data, encoding: .utf8)!)
}
}.resume()
}
}
On a similar note, some people seem to encounter this error when using the prettyPrinted option for the JSON serialization (i.e., in request.httpBody = try! JSONSerialization.data(withJSONObject: payload, options: .prettyPrinted). Could this be the culprit, given our secret key contains „/„ and „+“?
Many thanks!
On December 6, 2024, I received the following email.
Does this mean that there is something that needs to be done on the app side or on the Firebase side?
Currently, in our project, we are using Firebase to set up push notifications.
If anyone knows how to deal with this or has taken any action, could you tell me what specific steps you took?
Action Required: Apple Push Notification Service Server Certificate Update
As we announced in October,
the Certification Authority (CA) for Apple Push Notification service (APNs) is changing.
APNs will update the server certificates in sandbox on January 20, 2025,
and in production on February 24, 2025. To continue using APNs without interruption,
you’ll need to update your application’s Trust Store to include the new server certificate: SHA-2 Root : USERTrust RSA Certification Authority certificate.
To ensure a smooth transition and avoid push notification delivery failures,
please make sure that both old and new server certificates are included in the Trust Store before the cut-off date for each of your application servers that connect to sandbox and production.
At this time, you don’t need to update the APNs SSL provider certificates issued to you by Apple.
Dear Apple Support Team,
I hope this message finds you well.
I am reaching out to seek clarification regarding the behavior and limitations of silent push notifications on iOS devices. Specifically, I would like to understand the following:
Frequency: Is there a defined frequency limit for how often silent push notifications can be triggered? If so, what is the recommended or maximum frequency for sending silent push notifications to avoid potential issues?
Notification Limit: Is there a specific limit on the number of silent push notifications that can be sent to a device within a given time frame? If there are any constraints or best practices, could you please provide guidance?
Understanding these details will help ensure optimal implementation and avoid potential disruptions for users.
I appreciate your time and assistance. Looking forward to your response.
Best regards,
Akhil
I just wonder if it’s possible to add push notifications to an app made it Swift Playgrounds or if it always has to be exported to XCode first
HI, please can someone help?
I have a web app where push notifications are in place for Chrome, Firefox, and Edge. Providing the user allows notifications then when they log in for the first time their details are registered to the subscriptions table in the backend. All good so far.
When trying to do the same with Safari on Mac I'm faced with this issue:
"Safari doesn’t support invisible push notifications. Present push notifications to the user immediately after your service worker receives them. If you don’t, Safari revokes the push notification permission for your site."
and the user is not registered in the subscription table with the Safari console just saying variations of this:
[Warning] Notification permission denied. (notifications_frontend.js, line 177, x2)
[Log] Enable Notifications button clicked (notifications_frontend.js, line 245)
[Log] Safari Push Notifications detected (notifications_frontend.js, line 248)
[Warning] Safari Push Permission denied. (notifications_frontend.js, line 278)
I've found this on an another forrum:
"Safari requires that you immediately post a notification when a push message is received. "Immediately" means that it cannot be after some async operation.
If you display a notification immediately from the service worker itself, it will stop displaying that error. I cannot remember 100% but I think if you clear your cache and cookies you will be able to receive push messages again if you accidentally get blocked while testing."
and I've tried adding buttons to trigger allowing notifications but it all seem to late to get the subscription registered in the subscription table.
I'm pretty new to coding so if any has a similar experience and can advice how to get the subscriptions registered when the user logs on for the first time in Safari in a Mac it would be greatly appreciated.
Thanks...
We have just been granted access to the com.apple.developer.usernotifications.filtering entitlement, and are following the documented steps for handled E2EE VOIP notifications listed here: https://developer.apple.com/documentation/callkit/sending-end-to-end-encrypted-voip-calls
1 - A user initiates a VoIP call on their app. Their app then sends an encrypted VoIP call request to your server.
We do exactly this, Alice calls Bob from her app, sending a notification to our servers.
2 - Your server sends the encrypted data to the receiver’s device using a regular remote notification. Be sure to set the apns-push-type header field to alert.
We do exactly this, our server send on a notification to APNS with the apns-push-type header set to alert, destined for Bob.
3 - On the receiver’s device, the notification service extension processes the incoming notification and decrypts it. If it’s an incoming VoIP call, the extension calls reportNewIncomingVoIPPushPayload(_:completion:) to initiate the call. It then silences the push notification (see com.apple.developer.usernotifications.filtering).
I try to do exactly this. The notification is received by the NSE on Bob's device, which decrypts it and then notices it is a VOIP call from Alice. It prepares a dictionaryPayload with the decrypted data and then calls reportNewIncomingVoIPPushPayload(_:) async throws. This throws an NSXPCConnectionInterrupted error, which when logged shows as below:
Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.callkit.notificationserviceextension.voip" UserInfo={NSDebugDescription=connection to service named com.apple.callkit.notificationserviceextension.voip}
The only difference I can see to the documentation is that I am working in an asynchronous context so am using the asynchronous version of the method, but I don't imagine this should cause an issue?
I then supress the notification as documented and this works correctly.
Does anyone have any ideas why I am getting this error when calling reportNewIncomingVoIPPushPayload(_:) async throws?
You are probably aware of the upcoming root certificate change for any servers you might have that you use to send push notifications by connection to APNs.
If you are not, here is the announcement.
We have been getting some questions about this, and understand not everyone is familiar with their server setup.
First, we would like to clarify that this is only a change to your server's certificate trust store. You do not need to update anything else, like your APNs push certificates, the build certificates and provisioning profiles for your team/app, and so on. All you need to do is to install the mentioned new root certificate to your push server's trust store.
If you are using a 3rd party push provider, it is them who will need to handle their servers. But you may want to double check with them nevertheless.
If you are managing your own push servers that connect to APNs directly, then it is your responsibility to download and install the root certificate mentioned in the above link on your server(s).
Unfortunately we cannot provide specific instructions on how to install this root certificate on every kind of server out there. Each server operating system/push server software will have different ways these root certificates are installed, which is out of scope of our support abilities.
If you are not sure how to do this, I would recommend you seek help for this from your server-side developers or server admins.
Or, if you don't have access to such resources, you can ask the support channels for your system the question: How do I install a root certificate?
We have setup a test server at 17.188.143.34:443 that you can use to try and send pushes to test whether your new root certificate is correctly installed.
An alternative way to test this would be, from a terminal prompt:
openssl s_client -connect 17.188.143.34:443 -servername api.sandbox.push.apple.com -verifyCAfile USERTrustRSACertificationAuthority.crt -showcerts
Change the parameter to the -verifyCAfile argument to point to your trust store, and it should allow you to validate
Sample return results would be:
Connecting to 17.188.143.34
CONNECTED(00000003)
depth=2 C=US, ST=New Jersey, L=Jersey City, O=The USERTRUST Network, CN=USERTrust RSA Certification Authority
verify return:1
depth=1 CN=Apple Public Server RSA CA 11 - G1, O=Apple Inc., ST=California, C=US
verify return:1
depth=0 C=US, ST=California, O=Apple Inc., CN=api.sandbox.push.apple.com
verify return:1
Argun Tekant /
DTS Engineer /
Core Technologies
I have an app available for download in the Apple App Store. The app sends local notifications, which are scheduled at the user's request once the app launches. I've recently learned that when new versions of my app are deployed and automatically update on the user's device, previously scheduled local notifications are deleted. Given my app design, the user can re-launch the app in order to re-schedule the local notifications. This is a bit of a problem, though, because part of my app's value is in reminding the user - so after requesting a local notification, the user expects to receive a local notification and then launch the app, not the other way around.
Given this, I've been exploring solutions so my app continues to function as expected (including delivering local notifications, even if the app hasn't yet been launched) after an app update. I've explored .backgroundTasks(), but they too are apparently deleted with an app update and require the app to be re-launched first to work as expected. Another solution might be to use push notifications instead of local notifications, but that seems like a very involved solution if I'm just looking to make sure that local notifications persist after an app update. I can't be the only person to have this dilemma - am I overlooking a simple solution?
Every time I visit these forums, a banner is displayed at the top asking me to opt-in to notifications. I click "opt-in," the banner disappears, and no notifications are sent.
If I visit my forum profile, it says my browser isn't allowing notifications:
If I look in Settings->Websites, in the list of "These websites have asked for permission to show alerts in Notification Center," there are no apple.com websites whatsoever, including developer.apple.com. "Allow websites to ask for permission to send notifications" is checked, and I have many other websites in that list.
I consider this to be a bug in Safari, but maybe it’s an issue with the forum itself (although I doubt it). I've submitted a Radar for it, but haven't heard anything back (I never do).
EDIT: I realize I should've put this in another category, but it won't let me change that now.
Hi,
With the upcoming changes to the Apple Push Notification service (APNs) server certificates — including the SHA-2 Root: USERTrust RSA Certification Authority certificate update — I wanted to clarify if we need to take any action with Firebase Cloud Messaging (FCM).
Since we’re using FCM to send push notifications to iOS devices, does Firebase also need to update its server certificates in response to these changes, or will Firebase handle the updates automatically? We understand that Apple recommends updating our Trust Store to include the new certificates for APNs, but we’re unsure if any action is needed on our end for FCM specifically.
Thanks in advance for the clarification!
I am an iOS development engineer. Recently, I updated the Xcode version to 16.1 (16B40) and updated my debugging device (iPhone 15) to iOS 18.1.1. However, I found that I could not respond to the delegate method.
I confirmed that my code, certificate, Xcode settings, and network environment had not changed. Simply executing
application.registerForRemoteNotifications()
in
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
did not receive a response(didRegisterForRemoteNotificationsWithDeviceToken or didFailToRegisterForRemoteNotificationsWithError ).
In the same environment, when I switched to another device for debugging (iOS 17.0.3), the delegate method would respond.
I really don't know what to do, I hope someone can help me, I would be very grateful.
Please note: Everything is normal when using devices before iOS 18.1.1 version
We have a device which is an appliance and we are developing a control interface app for macOS and iOS/iPadOS.
How can we set up our iOS application to grab information from a local network device while it is in the background in order to show notifications?
Communication between the Apple device and our device is via local networking and the device is designed to be used on networks without internet connections. On networks with internet connections we could forward events from the device, via a server and APNS push notifications, but that isn't valid here.
Events occur on our device and are forwarded to clients, who are subscribed to Server-Sent Events. On macOS this works well and the application can receive updates and show Notification Center notifications fine.
On iOS we are using a BGAppRefreshTaskRequest with time interval set to 1 minute, but it appears that we get scheduled only every few hours. This isn't very useful as notifications just arrive in batches rather than in a timely manner. All normal networking is closed when the app goes into the background, so we cannot keep the SSE request open.
Another idea which we haven't tried yet: Creating a new endpoint on the device which keeps the connection open until a notification arrives, then using background URLSession to poll on that endpoint. Would that work? It seems like a mis-use of the API perhaps?