User Notifications

RSS for tag

Push user-facing notifications to the user's device from a server or generate them locally from your app using User Notifications.

User Notifications Documentation

Posts under User Notifications tag

225 Posts
Sort by:
Post not yet marked as solved
0 Replies
30 Views
Hi! I'm totally new on iBeacons and I've been reading the official documentation about it on Apple's website. https://www.cultofmac.com/270173/arent-people-freaking-ibeacon/LDzGJv7qcWDUcTYS.99 iBeacon on Apple Getting started with iBeacon https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html#//apple_ref/doc/uid/TP40009497-CH9-SW1 I understand that, as long as the app is installed, it is possible (since iOS 7.0) to detect when entering a region and manage to send a local notification to the user even when the app is totalle killed. The thing is that I can't find somewhere with an example that actually does that. I've been able to monitor my beacon and identify when I'm near, far, etc. and if I entered or exited the region.. while on foreground; but I haven't been able to do anything when the app is killed. I understand that the OS detects somehow that it entered the region and breefly wakes up the app just to let it know (which gives enough time to create a local notification), but I haven't find a reference to know which event is triggered or to what do I need my AppDelegate to subscribe. I've enabled "location updates" and "uses bluetooth LE accesories" on background modes, I have the proper privacy keys on info, I do both startMonitoring and startRangingBeacons on a view controller but my AppDelegate is subscribed as an observer to certain events. I would like to know if anyone here has an example or could point me to a nice direction to find out maybe which events on the AppDelegate get triggered or if I need to do something specific. Thanks a lot for any help you could give me!
Posted
by AngiB.
Last updated
.
Post not yet marked as solved
0 Replies
38 Views
So i’ve been testing voip calls of my app. One weird issue i noticed is that after few calls iphone stops receiving voip notifications. actually not just voip notifications but notifications from every other apps. i have two wifi networks at my home. when i switch from one network to other then suddenly voip notifications starts working and if there were any pending notification from other apps then those arrives too as soon as i change the network. Again i test calls few times and it works. then again same issue. if voip notifications doesn’t works then i just switch the network and notifications works. wondering if its iphone issue or ios or the router configuration thats delaying or preventing the notification from coming in.
Posted Last updated
.
Post not yet marked as solved
0 Replies
43 Views
I'm Facing an issue when i Debug Project in Real Device, I'm Getting Notification With Custom Sound, But After making a Build Via Diwai, I'm Not Getting Custom Sound, It Play Default Sound with Notification.I'm Using Firebase. I have Added Custom Sound in Project and added in Bundle Resources as well. Please Have A look on My Code. Here's My Code func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let content = UNMutableNotificationContent() content.sound = UNNotificationSound(named:UNNotificationSoundName(rawValue: "EigenIntro.caf")) FirebaseApp.configure() Messaging.messaging().delegate = self if #available(iOS 10.0, *) { // For iOS 10 display notification (sent via APNS) UNUserNotificationCenter.current().delegate = self let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] UNUserNotificationCenter.current().requestAuthorization( options: authOptions, completionHandler: { _, _ in } ) } else { let settings: UIUserNotificationSettings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil) application.registerUserNotificationSettings(settings) } Messaging.messaging().token { token, error in if let error = error { print("Error fetching FCM registration token: \(error)") } else if let token = token { print("FCM registration token: \(token)") } } application.registerForRemoteNotifications() return true } func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { print("Firebase registration token: \(String(describing: fcmToken))") self.sendDataToServer(token: fcmToken!) } func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { let userInfo = notification.request.content.userInfo print(userInfo) completionHandler([[.alert, .sound, .badge]]) } func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { let userInfo = response.notification.request.content.userInfo print(userInfo) completionHandler() } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { let token = deviceToken.hexString print("APNs Device Token: \(token)") Messaging.messaging().apnsToken = deviceToken Messaging.messaging().setAPNSToken(deviceToken, type: .prod) } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { Messaging.messaging().appDidReceiveMessage(userInfo) completionHandler(.noData) }
Posted
by jinal.
Last updated
.
Post not yet marked as solved
0 Replies
59 Views
Hi Team, We are trying to connect with our .pem file to apple, for testing pushnotification and here our UseCase Send - Connection Send -> Block a few minutes later Send -> Connection Send -> Block where Block = connection refused, so it failed to even "connect" to apple We also notice that the DNS resolved to many different IP addresses. Some work, some block some IP addresses send us reset packets which means we get connection refused and some complete the TCP handshake and work. When is the old SSL push notification supported up to before we have to swap to HTTP2? we are trying to work out IF this is still supported? any help would be appreciated Thanks in advance.
Posted
by Narijayu.
Last updated
.
Post not yet marked as solved
0 Replies
53 Views
We have tried all the suggestions on iPhone settings for iOS 15 and double checked code base as well as APNS payload. We have not sound on push notifications and don't understand what has changed. Our code base worked on previous iOS version on previous Apps. Is there a new way of getting sound in push?
Posted Last updated
.
Post marked as solved
1 Replies
118 Views
It seems that on iOS 16, image previews on push notifications are no longer visible. There used to show a small preview in a square to on the right side of the notification, but now the only way to view an image preview is to press and hold the notification (there is no indication which notifications have images without pressing and holding them!). Is this a bug or expected behavior? It seems ridiculous to drop support for this.
Posted Last updated
.
Post not yet marked as solved
0 Replies
66 Views
For my iOS app - when I set same thread-id for grouping and apns-collapse-id same for multiple notification, it works (notifications get collapsed). When I try same apns-collapse-id with different thread-id collapsing doesn't work. How are both related. I have debugged to make sure the values are correct
Posted Last updated
.
Post not yet marked as solved
0 Replies
60 Views
We are using communication notification to update notification icon, but for us it's not working for xamarin project. var handle = new INPersonHandle("unique-user-id-1", INPersonHandleType.Unknown); var avatar = INImage.FromName("abc.png"); var sender = new INPerson(handle, null, "Example", avatar, null, null); var intent = new INSendMessageIntent(null,INOutgoingMessageType.Text, "Message content", null, "unique-conversation-id-1", null, sender,null); // Use the intent to initialize the interaction. var interaction = new INInteraction(intent: intent, response: null); interaction.Direction = INInteractionDirection.Incoming; interaction.DonateInteraction((error) => { // ... }); NSError error1 = null; var content = request.Content; var updatedContent = content.Update(intent, out error1); contentHandler(updatedContent);
Posted
by avartak.
Last updated
.
Post not yet marked as solved
0 Replies
79 Views
On iOS14 or later, the body of push notifications is cut off at around 256 characters. For iOS13 or earlier, the entire body was displayed normally and the issue did not occur. Do you have any idea of the cause, such as a change in Apple's APNs or OS specifications? There is a limitation that "APNs support only 4096 bytes for the entire payload of a push message," but the notification size when an event occurs is 4096 bytes. We have confirmed that the size of the notification when an event occurs does not exceed 4096 bytes. Are there any other restrictions on the number of characters used to send push notifications?
Posted Last updated
.
Post not yet marked as solved
2 Replies
106 Views
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.
Posted Last updated
.
Post not yet marked as solved
1 Replies
216 Views
I tried to setup custom text for my app's push notifications permission alert by setting the NSUserNotificationsUsageDescription key in the info plist. It works flawlessly when I run the app on simulator, but running the app on a physical device still shows the default text provided by Apple. Is this a bug by Apple or am I doing something wrong? I am trying this with Xcode 13.4.1.
Posted Last updated
.
Post not yet marked as solved
0 Replies
98 Views
Notification to my app stopped working recently. According to the server response the message was delivered without errors but nothing is going through on device. We are using a Push Notification Key to send Notifications. I have recently migrated my account from Personal to Business. Not sure if that had an influence. I also did create a new key but that also did not make any difference.
Posted
by gbark.
Last updated
.
Post not yet marked as solved
1 Replies
113 Views
We use remote push notification with content available = 1, as per document it will wake up app, but it doesn't work properly, sometimes the app doesn't wake up. I have observed this behaviour mostly on iOS 15. We use this mechanism to send device location to our server. Why remote push notification doesn't wake up my app all the time?
Posted
by Ninad V.
Last updated
.
Post not yet marked as solved
2 Replies
923 Views
Hi guys,I'm experiencing a problem with the apns-expiration header when on Airplane mode.I'm using VoIP notifications to make audio/video call, and each notification has a lifespan of 15 seconds by setting apns-expiration header.This works for most of the cases but I found a case when doesn't work.This case can be reproduced by following next steps:- Mobile data ON with internet connectivity.- Airplane mode ON.- Receiving a VoIP notification with lifespan 15 seconds (when airplane mode ON).- Afer 15 seconds or more, Airpane mode OFF- I get the late (expired) VoIP notification.My guess it's that when we have mobile data ON and we turn airplane mode ON, the internet connectivity it's cut only for the user but Apple keeps it's persistent connection to the APNS server and even on Airplane mode notifications are delivered to the device instantly (if mobile data can reach Internet).And this is a little tricky and I don't know how to handle. I can get a late VoIP ghost call after 1 hour in this particular case. Before iOS 13 this could be handled by not presenting the incoming call to the user, but with iOS 13 we can't do this because “If app repeatedly fails to report an incoming call then Apple will stop delivering VoIP push notifications to the app altogether”.Apns-expiration header works great when I use only wireless connection, or explicitly I turn OFF the Mobile data instead of using Airplane mode.Do you have any insight regarding this problem?Thanks! Have a nice day!
Posted Last updated
.
Post not yet marked as solved
12 Replies
8.0k Views
I am banging my head. I am implementing push notification. Everything is working fine (push is received, badge is updated) but under iOS 13.3 the method application(_:didReceiveRemoteNotification:fetchCompletionHandler:) is not called when the app is in the background. If the app is in the foreground or using an iOS 12 device the method is called. I register for push notification in the following way (yes, it is still Objective C)[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (granted) { dispatch_async(dispatch_get_main_queue(), ^{ [[UIApplication sharedApplication] registerForRemoteNotifications]; }); } }];The payload is set to the following:{"aps": { "badge": 10, "alert": "test", "content-available": 1 }}I tried adding "Remote notifications" and "Background processing" as app capabilities in all variations (only "Remote notifications"/"Background processing", without any of those capabilities, enabling both) without any change. I set the delegate for the UNUserNotificationCenter but again without success. I set the headers accordingly:curl -v \ -H 'apns-priority: 4' \ -H 'apns-topic: xx.xxxxx.xxxx' \ -H 'apns-push-type: alert' \ -H 'Content-Type: application/json; charset=utf-8' \ -d '{"aps": {"badge": 10,"alert": "test", "content-available":1}}' \ --http2 \ --cert pushcert.pem \ https://api.sandbox.push.apple.com/3/device/1234567890From the docs it states that this method is called even when the app is in background:Use this method to process incoming remote notifications for your app. Unlike the application:didReceiveRemoteNotification: method, which is called only when your app is running in the foreground, the system calls this method when your app is running in the foreground or background.I tried with and without background modes (Remote Notification, Background processing, Background fetch) but without success. If I use an iOS 12 device, the method is called.My goal is to process some of the information in the payload (there might be additional information).What am I missing here for iOS 13 (13.3 to be exact)?
Posted Last updated
.
Post not yet marked as solved
1 Replies
255 Views
All our applications listed below, once installed in padOS15 (iPad mini 6 15.4.1) are not receiving any remote push notifications. We built our apps in XCode13.2.1. I also tried to install the latest XCode13.3.1 in macOS Monterey, but I got the same problem. It has no problem when installed on different devices and versions. Our apps: CLOMO SecuredBrowser for iFilter CLOMO SecuredMailer CLOMO SecuredDocs CLOMO SecuredContacts This is how to replicate it: Start the app Press the home button and the app goes to the background I change the profile settings on our server-side Wait for the remote push notifications. (the remote push notifications are received on other devices but not on this device) Expected result: remote push notifications should be shown on the device. When I checked the console log, I found that com.apple.Preferences removed delivered notifications as shown below. SpringBoard [com.apple.Preferences] Removing delivered notifications
Posted Last updated
.
Post not yet marked as solved
0 Replies
117 Views
Hello, I have been searching for documents related to Safari push notification configurations. I have found this one below, but it is archived and not sure whether it's still reliable. Up-to-date documents are mostly redirecting to upcoming Safari version (Safari 16 which will support push notifications in a different way). Was just wondering if there is an updated version for the document below, or if its still reliable as a guide for sending pushes to Safari versions below 16. https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW1
Posted
by denizts.
Last updated
.
Post not yet marked as solved
8 Replies
4.9k Views
Hi Team, I was trying to add NSE to my Project to show Rich messaging. Creation of the NSE target to the project - Successful. Creation of additional provisioning profile in developer portal for NSE and mapped it in XCode - Successful The APS payload contains the content-type: 1 and attachment url to download the media content - Successful. When notification arrive the will present method gets called first - Successful. The auto execution of Notification Service 'didReceive(_ request: UNNotificationRequest,          withContentHandler contentHandler: @escaping            (UNNotificationContent) - Void)' - failure. 6. Tried running the target instead of main app - failure 7. Tried attaching a debugger to get break point - failure 8. Debug and Console logs - failure 9. Additionally tried the below option from every developer suggestion but no luck. o  https://stackoverflow.com/questions/50853503/images-in-ios-push-notification o  https://stackoverflow.com/questions/51722109/unnotificationserviceextensions-didrecieve-not-called o  https://stackoverflow.com/questions/39663903/ios10-unnotificationserviceextension-not-called o  https://stackoverflow.com/questions/46463680/notificationserviceextension-not-called o  https://stackoverflow.com/questions/45483018/unnotificationserviceextension-not-working-on-iphone-5-ios-10 Could you please assist on the same to get it working as the notification service methods cannot be called explicitly and it needs to be triggered by OS. A quick, faster response and resolution is much appreciated.
Posted Last updated
.
Post not yet marked as solved
0 Replies
106 Views
I add my notification with UNTimeIntervalNotificationTrigger(timeInterval: 30*60, repeats: false) So I expect that my notification should be delivered after 30 minutes from current time. If I change time zone on my phone - all works correct. But If I change time manually, for example + 1 hour - then my notification is delivered to me at the time of change. Is there some way to handle this behaviour or is it expected? May be there is some documentation where describe this behaviour? Thanks in advance.
Posted Last updated
.