There is an issue with our app when showing a dynamic watch notification. Our app would sometimes receive a push notification with extra payload. In wOS6, the notification would be sent to the watch and show a dynamic detailed notification based on the data within the notification. But ever since wOS7, the watch does not show the data that is being sent.
We found out that the UNNotification that is being passed through in WKUserNotificationInterfaceController via. [didReceive:notification:](https://developer.apple.com/documentation/watchkit/wkusernotificationinterfacecontroller/2963125-didreceive) has an empty [userInfo](https://developer.apple.com/documentation/usernotifications/unnotificationcontent/1649869-userinfo).
I was wondering if anyone else have that issue. Or was there a change in wOS7 that prevents the userInfo from being received by the watch? Thanks!
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
I am trying to migrate to the new APNs Provider API.
Here is how I've been registering for push notifications:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
//-- Set Notification
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
// iOS 8 Notifications: Registering for notifications and types
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[application registerForRemoteNotifications];
}
else
{
// iOS < 8 Notifications
_storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
_storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert)];
if (launchOptions != nil)
{
NSDictionary* dictionary = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (dictionary != nil)
{
NSLog(@"Launched from push notification: %@", dictionary);
/*[self addMessageFromRemoteNotification:dictionary updateUI:NO];*/
}
}
return YES;
}
Within the last week, I have been using the following terminal command from Sending Push Notifications Using Command-Line Tools to successfully send a test push notification to a testing device.
curl -v --header 'apns-topic: com.domain.appname' --header apns-push-type: alert --cert aps.cer --cert-type DER --key PushChatKey.pem --key-type PEM --data '{"aps":{"alert":"Test"}}' --http2 https://api.sandbox.push.apple.com/3/device/258ecf658e25256c8f06ddb1138d5d536ba0e760a96ebd12d3b1dbe112857c58
Recently after creating provisioning profile and adding it to Xcode, the app no longer prints the device token in the debug window.
After removing the provisioning profile from my Apple Developer account under profiles, I tried using a backed up version of the app which still prints a device token to the debugger window.
When I copy the device token and enter it into the terminal command to send another test push notification, the terminal output is a 400 status code : {"reason":"BadDeviceToken"}* Closing connection 1
curl -v --header 'apns-topic: com.domain.appname' --header apns-push-type: alert --cert aps.cer --cert-type DER --key PushChatKey.pem --key-type PEM --data '{"aps":{"alert":"Hello From Faunna"}}' --http2 https://api.sandbox.push.apple.com/3/device/a146d82d4acea02c9ef6de5838174292d0e2cd18a40be17fb79334c5003a0058
* Could not resolve host: alert
* Closing connection 0
curl: (6) Could not resolve host: alert
* Trying 17.188.138.73...
* TCP_NODELAY set
* Connected to api.sandbox.push.apple.com (17.188.138.73) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
Enter PEM pass phrase:
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=api.development.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US
* start date: Feb 8 21:41:22 2021 GMT
* expire date: Mar 10 21:41:22 2022 GMT
* subjectAltName: host "api.sandbox.push.apple.com" matched cert's "api.sandbox.push.apple.com"
* issuer: CN=Apple Public Server RSA CA 12 - G1; O=Apple Inc.; ST=California; C=US
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fbd4700aa00)
> POST /3/device/a146d82d4acea02c9ef6de5838174292d0e2cd18a40be17fb79334c5003a0058 HTTP/2
> Host: api.sandbox.push.apple.com
> User-Agent: curl/7.64.1
> Accept: */*
> apns-topic: com.faunna.PushChat
> Content-Length: 37
> Content-Type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 1000)!
* We are completely uploaded and fine
< HTTP/2 400
< apns-id: 8DE6AA75-8E41-E95E-1FAF-51D93A8B3200
<
* Connection #1 to host api.sandbox.push.apple.com left intact
{"reason":"BadDeviceToken"}* Closing connection 1
What is causing the bad device token output in this set up? And how should I be registering for remote notifications from this point forward?
Hello everyone!
Our team is in the middle of developing a new sleep tracking app with a bunch of additional features including a custom alarm clock. And we need Critical Alerts entitlement for this feature to work as only such notifications (critical interruption level for iOS 15) can break through Silence Ring & Do Not Disturb mode, which is necessary as users obviously won't wake up without the alarm actually going off.
We've applied twice already, clearly stating the purpose of this entitlement, but both times received the same answer: "Unfortunately, this API is not designed for the use you've identified".
While Apple Developer documentation on the matter is rather elusive and states that, among others, home- & health-related purposes are allowed, I couldn't find any straightforward info about our particular case. Moreover, I can easily name a few apps in the Health & Fitness category with exactly the same alarm clock functionality that works and obviously utilizes Critical Alerts entitlement.
So I wonder, can anyone give a piece of advice on how to get this entitlement? Maybe we need to provide some additional info or meet some unannounced conditions? Any info will be highly appreciated.
What does APS stand for in APS Environment Entitlement?
Hello,
When attempting to assign the UNNotificationResponse to a Published property on the main thread inside UNUserNotificationCenterDelegate's method
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async
both Task { @MainActor in } and await MainActor.run are throwing a NSInternalInconsistencyException: 'Call must be made on main thread'.
I thought both of them were essentially doing the same thing, i.e. call their closure on the main thread. So why is this exception thrown? Is my understanding of the MainActor still incorrect, or is this a bug?
Thank you
Note: Task { await MainActor.run { ... } } and DispatchQueue.main.async don't throw any exception.
It looks like APS Environment is configured by setting the aps-environment value in an app entitlements file to either development or production. However, it seems to be the case that, by default, Xcode automatically overrides the set value when an app is signed and the value is instead derived from the provisioning profile.
So, for development profiles, you get development (sandbox) aps-environment, and for distribution profiles, you get production aps-environment configured - regardless of how the setting has been configured in the entitlements plist.
This is documented here: https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment
That document also states that this default behaviour can be overridden: "These default settings can be modified".
Question is, how to override these default settings. In other words, how to point aps-environment to production, even if provisioning profile is development.
Any insight appreciated, thx.
Are “Notification Service Extensions” officially supported on macOS?
I’m developing an app for both iOS and macOS (not Catalyst). I’ve successfully setup a separate notification service extension for both the iOS and macOS targets. The iOS extension is modifying the CKSubscription push notification as expected. However the macOS notification service extension is not being launched at all no matter what I seem to try, matching deployment targets etc.
I’m also asking because although Apple docs report that support for UNNotificationServiceExtension was added in macOS 10.14, the article at https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications makes no mention of macOS, only iOS.
Hello,
i am implementing Live Activity and facing a problem setting custom color for widget background.
I have a dedicated catalogue of colors for WidgetExtension each having light/dark variant.
The problem is, however, that widget's view changes color variants (any/dark) according to system settings, but not system background & text of widget set via .activityBackgroundTint(_:) and activitySystemActionForegroundColor(_:)
Both widget background and system button texts remain in light variant no matter what system setting was when starting Live Activity.
Later, i was able to kinda force LA background color by checking color scheme in my widget view (yellow and brown for test purposes)
.activityBackgroundTint(colorScheme == .light ? Color.surface. : Color.brown)
this would force Live Activity background to have expected color from start.
BUT
when i later change appearance in system settings Live Activity behaves weirdly, as if it was caching previous color I provided.
I installed 16.2 beta in hope that it was fixed, but noticed this behaviour 👇
system in light mode: LA start, LA background is light
set system to dark: LA background light
set system to light: LA background dark ❗️
set system to dark: do not pull notification center, do not look at LA, instead immediately 👇
set system to light: LA background light
Is there any way around this? 🙏
We are updating a Live Activity via push notifications quite frequently. As the documentation suggests, we are using NSSupportsLiveActivitiesFrequentUpdates for this case. We are sending all updates with apns-priority: 10.
Is it still possible that iOS throttles push-updates with this setting enabled?
For example we sent updates to APNS in this frequence:
2023-06-09T09:21:22.492224Z
2023-06-09T09:22:03.415876Z
2023-06-09T09:22:05.643268Z
2023-06-09T09:22:08.567353Z
2023-06-09T09:22:11.988442Z
2023-06-09T09:22:17.983494Z
2023-06-09T09:22:28.400757Z
2023-06-09T09:22:44.185622Z
2023-06-09T09:23:06.633058Z
2023-06-09T09:23:23.560052Z
2023-06-09T09:23:31.863625Z
2023-06-09T09:23:37.18351Z
2023-06-09T09:23:44.086319Z
2023-06-09T09:23:49.40655Z
2023-06-09T09:24:08.034848Z
2023-06-09T09:24:18.614194Z
2023-06-09T09:24:20.176428Z
2023-06-09T09:24:25.384654Z
2023-06-09T09:25:03.103147Z
2023-06-09T09:25:15.433726Z
2023-06-09T09:25:21.171693Z
2023-06-09T09:25:23.262028Z
2023-06-09T09:25:28.241116Z
2023-06-09T09:25:30.19816Z
2023-06-09T09:25:32.440543Z
2023-06-09T09:25:42.381815Z
2023-06-09T09:25:50.581656Z
2023-06-09T09:25:55.659846Z
2023-06-09T09:26:15.042667Z
2023-06-09T09:26:26.924626Z
2023-06-09T09:26:28.608762Z
2023-06-09T09:26:32.012874Z
2023-06-09T09:26:39.111211Z
2023-06-09T09:26:40.415326Z
2023-06-09T09:26:51.142985Z
2023-06-09T09:26:54.364073Z
2023-06-09T09:27:04.225692Z
2023-06-09T09:27:30.80347Z
2023-06-09T09:27:33.560981Z
2023-06-09T09:27:42.334313Z
2023-06-09T09:27:43.834646Z
All of those were sent successfully, but at some point the activity stopped updating. The activity continued for several hours after, but was never updated again.
What I checked so far:
From device logs we can see that there was no updated push-token
The sent content-state is correct
From these observations and considering the high-frequent updates, I suspect that there is still some throttling happening here.
Can anyone elaborate on this?
Thanks in advance.
There's an issue in the iOS 17 beta where passing nil to activityBackgroundTint(_:) does not use the system's default background material as expected. Instead, it's showing a solid black color instead of the correct tint that matches the rest of the system in iOS 16.
1- Did activate audio session get called in both receiveing and transmiting what the best practice to handle Playback & Recording.
2- how to playback audio after that cuse in background websocket get killed "Software caused connection abort".
Thanks in advance.🙏🏻
Hi there,
This is my first time posting here. I'm working on small projects on Swift and SwiftUI now and then. I'm currently trying to develop an application that gets some bus arrival data using API and displaying them with live activities. The thing is that I'm not quite sure how frequently updates work yet. Still trying to figure out if I can update the live activity everytime the data coming right from the API changes or use push notification updates each minute passing by, but that is another thread that I'm going to focus with more details.
Everytime i'm trying to deploy my app on my iphone or a simulator this error keeps popping up and I can't figure out why.
Any ideas? Let me know if you need any snippet of my code.
SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'com.gregorikouk.MapKitTut.BusWidgetKit' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}." UserInfo={NSLocalizedDescription=Failed to show Widget 'com.gregorikouk.MapKitTut.BusWidgetKit' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}., NSUnderlyingError=0xb1281d830 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}}}
Domain: DTXMessage
Code: 1
User Info: {
DVTErrorCreationDateKey = "2023-10-02 21:06:04 +0000";
}
--
System Information
macOS Version 14.0 (Build 23A344)
Xcode 15.0 (22265) (Build 15A240d)
Timestamp: 2023-10-03T00:06:04+03:00
Hello everyone,
I have been working on a macOS app that utilizes push notifications for the past year. Up until recently, everything was functioning correctly. However, now I'm experiencing issues where push notifications are either not being delivered at all or are experiencing significant delays, sometimes up to 10 minutes. Setting the priority header to 10 hasn't made any difference. I am currently using development push notifications, but the issue persists when switching to the production environment.
I'm curious if anyone else has encountered similar problems. When checking the push console, it frequently reports that the device is offline, even though it's actually online ("discarded as device was offline"). Occasionally, notifications are delivered promptly, but this is becoming increasingly infrequent.
This issue has been consistently reported by our testers, particularly after they updated to macOS Sonoma. Any insights or assistance you can provide would be greatly appreciated.
Hello,
I am reading up on the documentation and seems to have some discrepancies but wanted to double check.
In Overview for PTChannelManager, it states "Multiple calls to channelManager(delegate:restorationDelegate:completionHandler:) result in the system returning the same shared instance, so store the channel manager in an instance variable." https://developer.apple.com/documentation/pushtotalk/ptchannelmanager
However if we look at the documentation for creation of a channel manager,
in the completionHandler, it states that it will return "A new channel manager instance."
https://developer.apple.com/documentation/pushtotalk/ptchannelmanager/4031737-channelmanager
So is it a shared instance that gets returned or will a new instance be created? Need to know if we will need to implement a multiDelegate Pattern or not for this scenario for example if someone else called this function, would they take over the callbacks or would they get their own instance?
Thank you.
Is there a way for a progressive web app to use the Live Activity feature?
Some users couldn't receive push notifications, and APNS returned a 'DeviceTokenNotForTopic' error. Upon validation using Apple's tool, I found that some tokens are identified as VoIP push tokens, and some as Live Activity (LA) push tokens.
When attempting to send a normal alert push using these VoIP/LA push tokens, it didn't work and returned a 'DeviceTokenNotForTopic' error.
These tokens were obtained from Apple's delegate function 'didRegisterForRemoteNotificationsWithDeviceToken.' It's unexpected to receive VoIP/LA push tokens from this event, but this issue is occurring, and I've observed it specifically in iOS 17 users.
This problem is not universal and is happening only for some users. Please take note that our app support VoIP Push, Live Activity Push and Normal Push notification.
Could this be an iOS 17 bug? Any advice on this matter would be appreciated.
Thanks.
Hi,
Some of my iOS test devices do not receive PushKit notification anymore. I request and receive a VoIP token at app startup, then register it. I report any incoming PushKit notification directly to CallKit on the same thread.
But some devices do not receive the PushKit/VoIP notification (app in foregroud or in background). They used to. Some other devices are receiving it with the same code, for a successful call.
I tried reinstall and device restart with no success.
I can see on the problematic devices at app startup in the console:
callservicesd XPC PushKit connection invalidated from client <private>
before seing:
callservicesd Registering client process <private> with bundle identifier <private> for PushKit voip in environment <private>
I could not find anything on "PushKit connection invalidated from client", anyone knows what triggers it?
Thanks.
Our PTT framework app works great but we have now found an interesting scenario where you can get the PTT Framework in a state that is non functional.
Here's how it can be reproduced:
Start your PTT app ( With PTT framework ) Successfully joined channel and we can transmit and receive incoming transmits.
Put app in background. ( PTT framework/GUI symbol present in top)
Wait 1 min
Restart phone by pressing volume up + right side button
Wait 1 min
Start phone
We can now get two scenarios:
"Sceanario *1": In 4 of 5 cases the PTT framework symbol will be present directly when phone is started.
If we here start running our app we can see that the channel is restored and everyting works perfectly.
"Sceanario *2": In 1 of 5 cases the PTT framework symbol is not present after phone is started, and will not be even if waiting.
If we here start running our app we can see that the channel is also here restored (channelDescriptor(restoredChannelUUID channelUUID: UUID) -> PTChannelDescriptor) and we can successfully call "mgr.setTransmissionMode(newTransmissionMode, channelUUID: self.channelUUID)" on our channel ( PTT framework symbol still not present !!!!)
If we now try to call "requestBeginTransmitting(channelUUID: UUID)" we will get the PTChannelError error channelNotFound !!!!
We are then reacting to this and trying to do leave the channel "leaveChannel(channelUUID: UUID)" but also this is returning PTChannelError error channelNotFound in "channelManager(_ channelManager: PTChannelManager, failedToLeaveChannel channelUUID: UUID, error: Error))" !!!!
The interesting thing here is that my log is saying the following:
PTTFrameworkImpl: failedToLeaveChannel 6D5AFE96-9389-4CFB-893A-64D51D4542XX error=The operation couldn’t be completed. (com.apple.pushtotalk.channel error 1.), joined=true, activeChannelUUID is=6D5AFE96-9389-4CFB-893A-64D51D4542XX.
So we are getting channelNotFound for 6D5AFE96-9389-4CFB-893A-64D51D4542XX but when at the same type checking active channel with channelManager.activeChannelUUID we are getting 6D5AFE96-9389-4CFB-893A-64D51D4542XX.
After this we logout our user in our app.
If we now try to login again we will get a scenario where "requestJoinChannel(channelUUID: UUID, descriptor: PTChannelDescriptor)" will result in just NO RESPONS in means of
"channelManager(_ channelManager: PTChannelManager, didJoinChannel channelUUID: UUID, reason: PTChannelJoinReason)" or "channelManager(_ channelManager: PTChannelManager, failedToJoinChannel channelUUID: UUID, error: Error)"
FYI: The fault are occuring on 17.3 also and the syslog I provided here is on 17.3 developer beta
One interesting observation we have seen is that we only see this problem when "allow location access" is set to never for our app.
Hi. I would like my App to be notified when the phone rings. No, not CallKit-CallKit is for VoIP and does not cover Cellular connections (as of 2/26/24) but, thanks. To continue..
I understand ages-ago there was a Telephony Kit or Framework but, has been discontinued. Has it been replaced with something else?
I would like something that seems very simple:a) when the phone rings my App is notified, b) when it stops ringing (combine all possibilities; sent to voicemail, user cancels, user answers) my App is notified.
Yes, I understand UserNotifications can make things run but, as I understand it this feature is for the App to schedule notifications, not receive them? If you know of something in UserNotifications that I can leverage I would appreciate your input.
Lacking other possibilities I find myself wondering about Siri integration. Siri is notified about system events and generates notifications based upon these events. Is there some way to place my App downstream from Siri and receive system notifications? Thanks everyone.
Hello,
I am developing a service using Voip Push.
Recently, it seems that Voip Push notifications are occasionally arriving late.
Does anyone have information regarding this issue?
Sometimes, when the delay is prolonged, notifications from a few days ago also seem to be received.
Thank you.