Notification Center

RSS for tag

Create and manage app extensions that implement Today widgets using Notification Center.

Posts under Notification Center tag

51 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

OAuth login from NEPacketTunnelProvider
How can NEPacketTunnelProvider launch the companion application, or notify user to launch the application? I have built an iOS VPN that uses credentials stored in the keychain, and it works as expected. Now I'm trying to add OAuth login support. Everything works fine at first. I login from the companion application, store tokens in the keychain, then launch the VPN from either System Settings or the companion application. However, when the OAuth refresh tokens expire, or the OAuth IdP otherwise requires login, I can't perform the OAuth login from the NEPacketTunnelProvider. Login must happen from the companion application, which likely isn't running. I need the NEPacketTunnelProvider to either launch the companion application directly or to notify the user to do so. Searching and reading docs yields: You can't perform OAuth login from within the NEPacketTunnelProvider because it requires user interaction There is no way to guarantee that the companion application is running on iOS (otherwise one would use NEVPNStatusDidChange) You can't launch the companion application from NEPacketTunnelProvider using a custom URL because of security concerns You might be able to launch the companion application from a system extension... Some sources say you still can't guarantee that the system extension is loaded whenever the NEPacketTunnelProvider needs it anyway. Of course, any of these conclusions could be wrong. At this point I'm not sure where to begin. Is there another approach that could be initiated by the NEPacketTunnelProvider (push notifications, system notifications, smoke signals)? Any help would be appreciated. Thanks, Bill Welch
0
0
70
12h
Question About APNs Server Certificate Update and Firebase Cloud Messaging
Hi, Regarding the announcement about the Apple Push Notification Service (APNs) Server Certificate Update, I wanted to clarify whether it will impact my app’s push notification setup. I use Firebase Cloud Messaging (FCM) to send push notifications to iOS devices, and in my Firebase project settings, I have configured an APNs Authentication Key under the Apple app configuration tab (Firebase Console > Project Settings > Cloud Messaging > iOS app configuration). The authentication key I am using was generated from Apple Developer > Certificates, Identifiers & Profiles > Keys. Since I am using this authentication method instead of APNs certificates, are there any changes I need to be aware of due to the APNs server certificate update, and do I need to update anything in my current configuration to ensure push notifications continue to work? Thanks in advance!
1
0
506
1w
Refresh Widget doesn't work from background push notification.
As stated in other posts like: https://developer.apple.com/forums/thread/734488 https://developer.apple.com/forums/thread/652946?answerId=823555022#823555022 Even though the recommended way from Apple documentation is to use push notifications to reload widgets timelines calling WidgetCenter.shared.reloadAllTimelines(), it is unreliable and I couldn't find a pattern of why it works 10% of times and not the other 90%. While the debugger is connected to the App it always works though. My widget needs to reflect updated information otherwise it becomes useless since it display smart home devices states such as the Apple Home widget does as well.
1
0
141
3d
watchOS Standalone App Notification Settings Not Appearing
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.
0
0
176
4w
Skipping Notifications permission alert on sequoia
Hello, it seems like starting from iOS 18.0, it is possible to entirely skip the notifications permission request alert by swiping up from the bottom of the screen. It doesn't work this way with any other kinds of system alerts, nor in iOS 17.4 (tested it in the Simulator though). So, is it a bug? Or is it intended? Either way, I haven't found any information regarding that. The problem with that is when you skip the alert, notifications are missing from the app preferences.
1
0
171
Jan ’25
Push Notification Gets Removed From Notification Screen When Setting "badge" to 0
Push message on the lock-screen disappears in one specific instance. In general the situation is as follows: the application, upon starting up, sets the badge counter (i.e. notificationCenter.setBadgeCount(3)) the application is being sent to background the screen is locked (it doesn't matter if it's turned on or not) send a push message to the application and set the badge (in aps) to "0" What happens: the screen lights up (unless it's lit up already), the push is being displayed for a very short time and gets hidden. Happens on iOS 18.1, 18.1.1, 18.2. If not setting badge in the aps keys it works correctly. I've created a feedback report https://feedbackassistant.apple.com/feedback/16095572. I am able to reproduce the issue on a sample app 100% of the time :/
2
0
324
Dec ’24
iOS 18.2 Heavy Delays in Notifications with AI enabled
I am experiencing heavy delays with any push notification if I have AI enabled. Authenticator takes minutes to show up, the app for the doorbell that, needless to say, requires a real-time notification, fails to deliver push notifications in time. I have had to turn off AI in order to have a functioning phone... (I'm on a 16 Pro) Any resolution on this? Thanks
2
1
562
Dec ’24
Does Firebase Push Notification Service Need New Certificates Due to APNs Update
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!
6
4
11k
Dec ’24
Notifications on iOS sourced from a machine on an offline local network
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?
9
0
519
Dec ’24
Regression: iOS 18.2 heavy delay of local push notifications (even time sensitive notifications)
Hello! I am working on an app that requires to send a local push notification to the user from an app extension (from the ShieldActionDelegate to be precise). This is suggested by DTS as a workaround for this issue: https://forums.developer.apple.com/forums/thread/766644 But now, on the iOS 18.2 beta, local push notifications are delayed by up to 10 seconds, even though the push notification is classified as .timeSensitive, leading to a very bad user experience (where to user has to sit and wait for the notification to arrive without knowing how long it will take). This only happens when Apple Intelligence is turned on. This had happened previously on the iOS 18.1 beta but was fixed for the final release: https://forums.developer.apple.com/forums/thread/764848 But now the issue came back on the latest iOS 18.2 beta. I have documented the new behavior in FB15668616 Any help is appreciated!
3
3
1.6k
Nov ’24
Actionable notifications on watchOS don't get iOS variables
I am developing an app which makes use of actionable notifications. On my code (the func userNotificationCenter function), I need to read my users from the local storage on the iPhone: let query: [String: Any] = [ kSecAttrService as String: "uio-auth", kSecAttrAccount as String: "users", kSecClass as String: kSecClassGenericPassword, kSecReturnData as String: true ] var result: AnyObject? SecItemCopyMatching(query as CFDictionary, &result) let ref = result as? Data But when the same code execute when I tap on the notification on the Apple Watch, it doesn't fetch anything. It now occurs to to me: Does it mean that when an actionable notification programmed for the iOS is displayed on the Apple Watch, it tries to access its own storage, and not the iPhone? If so, is there a nice way to pass the values to the watchOS so that when the callback for the actionable notifications run, it has then the data it needs?
0
0
343
Oct ’24
Hourly repeating notification.
Somebody help me please. I try to set specific time for notification, it works nice, but if you need a little beat more functional this is where difficulties appear. I'd like to give opportunities for repeat, example every hour. I know that UNCalendarNotificationTriger has a repeat value, but when you set repeat on true it remember date component, exp - .minute, and then just repeating notification every time when that minute comes! I'm looking for solution for set notification at special time(exp: 5:00 pm), and then repeating this notification every hour(6, 7, 8, 9 pm) Maybe it's so easy but looks like I feel stuck 😕
2
0
397
Oct ’24
Custom notification images are confused with those from other apps.
My app uses custom notifications with custom images. Why do these images get mixed up with those from other apps, causing my notifications to display images from other apps? `INImage *avatarImage = [INImage imageWithImageData:imageData]; NSPersonNameComponents *nameComponents = [[NSPersonNameComponents alloc] init]; nameComponents.nickname = content.title; INPersonHandle *handle = [[INPersonHandle alloc] initWithValue:nil type:INPersonHandleTypeUnknown]; INPerson *messageSender = [[INPerson alloc] initWithPersonHandle:handle nameComponents:nameComponents displayName:content.title image:avatarImage contactIdentifier:nil customIdentifier:customIdentifier isMe:NO suggestionType:(INPersonSuggestionTypeNone)]; INSpeakableString *speakableString = [[INSpeakableString alloc] initWithSpokenPhrase:content.subtitle.length ? content.subtitle : @""]; INSendMessageIntent *intent = [[INSendMessageIntent alloc] initWithRecipients:@[messageSender] outgoingMessageType:(INOutgoingMessageTypeOutgoingMessageText) content:content.body speakableGroupName:speakableString conversationIdentifier:identifier serviceName:nil sender:messageSender attachments:nil]; [intent setImage:avatarImage forParameterNamed:@"speakableGroupName"]; INInteraction *interaction = [[INInteraction alloc]initWithIntent:intent response:nil]; interaction.direction = INInteractionDirectionIncoming; [interaction donateInteractionWithCompletion:nil]; UNNotificationContent *_content = [content contentByUpdatingWithProvider:intent error:nil]; UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:identifier content:_content trigger:trigger]; [UNUserNotificationCenter.currentNotificationCenter addNotificationRequest:request withCompletionHandler:completionHandler];`
3
1
481
Oct ’24
Local notification shown in iphone not shown on apple watch
I created a local notification as follows: func scheduleNotification(title: String, subtitle: String = "", date: Date, id: String) { // Extract the components from the date let calendar = Calendar.current let hour = calendar.component(.hour, from: date) let minute = calendar.component(.minute, from: date) let second = calendar.component(.second, from: date) // Set the extracted components into DateComponents var dateComponents = DateComponents() dateComponents.hour = hour dateComponents.minute = minute dateComponents.second = second let content = UNMutableNotificationContent() content.title = title content.subtitle = subtitle content.sound = UNNotificationSound.default let action1 = UNNotificationAction(identifier: Constants.NOTIFICATION_ACTION_IDENTIFIER_1.id, title: Constants.NOTIFICATION_ACTION_IDENTIFIER_1.label, options: []) let action2 = UNNotificationAction(identifier: Constants.NOTIFICATION_ACTION_IDENTIFIER_2.id, title: Constants.NOTIFICATION_ACTION_IDENTIFIER_2.label, options: []) let category = UNNotificationCategory(identifier: "reminderCategory", actions: [action1, action2], intentIdentifiers: [], options: []) UNUserNotificationCenter.current().setNotificationCategories([category]) content.categoryIdentifier = "reminderCategory" let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: false) let request = UNNotificationRequest(identifier: id, content: content, trigger: trigger) // add our notification request UNUserNotificationCenter.current().add(request) } and I also have func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { // Handle foreground presentation options completionHandler([.sound, .badge]) } but for some reason the notification only shown on the phone. I've made sure that the phone is locked, apple watch is unlocked and also the notification setting in the watch app for this app is set to mirror.
0
0
358
Oct ’24
Request authorization for the notification center crash iOS app on Swift 6
Hey all! During the migration of a production app to swift 6, I've encountered a problem: when hitting the UNUserNotificationCenter.current().requestAuthorization the app crashes. If I switch back to Language Version 5 the app works as expected. The offending code is defined here class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure() FirebaseConfiguration.shared.setLoggerLevel(.min) UNUserNotificationCenter.current().delegate = self let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { _, _ in } application.registerForRemoteNotifications() Messaging.messaging().delegate = self return true } } The error is depicted here: I have no idea how to fix this. Any help will be really appreciated thanks in advance
17
2
2.7k
3w
Post Notification to RCP but Timeline won't fire
I am trying to use onNofitication in BehaviorComponent to fire up my composed timeline actions. Which is formed up by one TransformTo action, one Hide action and followed by a Notification action indicating the other two actions are finished. With this post, I successfully send a notification to RCP to fire up my timeline with identification: NotificationCenter.default.post( name: NSNotification.Name("RealityKit.NotificationTrigger"), object: nil, userInfo: [ "RealityKit.NotificationTrigger.Scene": scene, "RealityKit.NotificationTrigger.Identifier": "onSomethingStart" ] ) On the other hand, to subscribe that Notification Action, I append a onReceive function below my RealityView, and succesfully received my notification private let notificationTrigger = NotificationCenter.default.publisher( for: Notification.Name("RealityKit.NotificationTrigger")) guard let entity = out.userInfo?["RealityKit.NotificationTrigger.SourceEntity"] as? Entity, let notificationName = out.userInfo?["RealityKit.NotificationTrigger.Identifier"] as? String else { return } debugPrint("Received notification: \(notificationName), entity name: \(entity.name)") Which means that my Timeline is fired up because I can received my notification in my Timeline. But the rest two actions just don't appear to be working. I played the timeline in RCP it works fine. Anything I missed to make it tick? XCode beta 16.1 VisionOS beta 9
2
0
641
Sep ’24
The notification is invalid
I can execute an action by allowing Xcode to send a notification to Reality Composer Pro via NotificationCenter, or I can send notifications to Xcode through the Notification Action in Reality Composer Pro. However, I discovered that they were unable to accept notifications from both parties within my project. To ascertain whether there was an error in my code, I created a simple Demo project. I utilized the same code and determined that it functioned normally within the Demo project. It is perplexing that I am unable to resolve this issue. Do I require additional modifications?
1
0
571
Aug ’24