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
219 Views
Dear apple developer community... I am facing the problem on creating my own pushPacakge and .p12 webpush certificates file for safari push notifications. I follow all steps carefully on an official document here with my team. And also try to follow some tutorials on some blogs which corresponding to its. But it still doesn't work. Here's how my problem looks like I've got .p12 file then I've test to upload it into some push service like oneSignal, truePush and etc. It's able to upload the file but the push service still doesn't work. But if I used a provided .p12 from their service, the notification will working properly. I try to use my .p12 to generate a push package (pushPackage.zip). But the api log on my webServiceUrl keep showing me "{ logs: ['Signature verification of push package failed'] }". Even if I try all versions of AppleWWDRC (G1-G6) downloaded from here. And even I use an official php script (createPushPackage.php) file from apple apn document downloaded from here on the top right corner at companion file Here's what I've done so far to get my own .p12 file... Generate my own CSR file from mac keychain application Noted1: My appleId on my mac is an Admin role only on apple developer account (Not a Admin, Account Holder role) Noted2: I've try to enter an apple id with role Admin, Account Holder on a User Email Address field but it still doesn't work Login into an apple developer account console on apple developer site Go to identifier tab and create new webPushId identifier Enter description and webPushId(reverse domain name style which is web.com.herokuapp.kkwebpush) Come back to certificates tab and create new certificate (select webPushId radio button and click create) Choose webPushId that already created on step 4 from dropdown list then click on continue Upload CSR file that generated on step 1 into its Download .cer file Click on the downloaded .cer file from step 9 and generate .p12 file by keychain Here's how I create pushPackage.zip file Create folder to store all files needed ( reference from here ) which are AppleWWDRCA.cer Certificates.p12 (Generated from step 9 above) createPuchPackage.php (Official script from apple which already edit the path to Certificates.p12 and enter private key match with my Certificates.p12 password) intermediate.pem (Generated from export AppleWWDRCA.cer on keychain as intermediate.pem) pushPackage.raw (folder that contain both icon.iconset and website.json that already set matched webPushId and webServiceUrl inside website.json) So, the folder structure now look like this Then I start to run php createPushPackage.php inside this folder. After that I've got an unreadable format result on my terminal .But I still get a pushPackage.zip file stored at /tmp folder (At this point I think it might be fine with that unreadable format) . Head over to my tmp folder to move that pushPackage.zip file into my webServiceUrl endpoint directory for send a pushPackage when apple api model was called on window.safari.pushNotification.requestPermission ( Already set these 4 parameters below) url as my web service url to my endpoint websitePushID as my web site id registered on apple developer console userInfo as empty object {} callback as function as a callback function FINALLY MY FINAL QUESTIONS ARE... Are there any steps that I've missed? Why I keep getting { logs: ['Signature verification of push package failed'] } on my web service url log errors endpoint? Does my certificate is invalid? (If yes, what are all possible causes) Why I can't use my own .p12 file on other push services (oneSignal, truePush and etc.) that support custom upload .p12 file for safari push notification? * When I used a provided .p12 from their service, everything works fine (safari permission popup can appear). On the other hands, If I use my own .p12, I can upload its to their services but safari permission popup don't show up)? Any solution please? Thanks
Posted Last updated
.
Post not yet marked as solved
5 Replies
712 Views
Hi, When receiving provisional user notifications in iOS 15 the "Turn Off..." button works fine, but the "Keep..." button doesn't save the settings. "Deliver Immediately" option doesn't do anything and "Deliver in Scheduled Summary" hides the buttons, but they appear again in next notification. I've noticed this behavior with several different apps, for example Reddit. Does anyone know anything about this? I have also submitted a bug to Apple but no response so far.
Posted
by AntonM.
Last updated
.
Post not yet marked as solved
1 Replies
600 Views
We have recently created a new Website Push Certificate to support our implementation of Safari Push notifications as our current certificate was nearing expiry. When we have tested with the new certificate we keep getting "Signature verification of push package failed." logged to our log endpoint and the user is not shown the Opting In dialog. I can see in the safari console that permission has been denied. I have checked to ensure that the new website push id has been updated in our code. This page https://developer.apple.com/support/expiration/ indicates that the intermediary certificate for Website Push Id was changed to the G4 certificate on the 27th January 2022. We had this intermediary certificate installed when generating the certificate. I suspect the new G4 certificate in the chain is causing an issue but I'm not sure how resolve it. I have tested the push package created with the companion files in the official documentation and we get the same error using the supplied scripts. Can anyone help?
Posted
by andylith.
Last updated
.
Post marked as solved
4 Replies
344 Views
I'm trying to configure Local Push Connectivity. I already have Local Push Entitlement, and have install a provisioning profile with local push entitlement. It's build fine but when app start, PushProvider didn't active and start and Push Manager show error nil. I have done every instructions that sample code have provided. This is my project. In my application target, I have a bundle id com.my_team_name.my_app_name and in the app group name group.com.my_team_name.my_app_name In the .entitlement, I've set the required configuration: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.developer.networking.networkextension</key> <array> <string>app-push-provider</string> </array> <key>com.apple.developer.networking.wifi-info</key> <true/> <key>com.apple.security.application-groups</key> <array> <string>group.com.my_team_name.my_app_name</string> </array> </dict> </plist> Info.plist has noting to change And I have a PushManager Class with this code class AppPushManager: NSObject, NEAppPushDelegate{ func appPushManager(_ manager: NEAppPushManager, didReceiveIncomingCallWithUserInfo userInfo: [AnyHashable : Any] = [:]) { } static let shared = AppPushManager() private var pushManager: NEAppPushManager = NEAppPushManager() private let pushManagerDescription = "PushDefaultConfiguration" private let pushProviderBundleIdentifier = "com.my_team_name.my_app_name.PushProvider" func initialize() { if pushManager.delegate == nil { pushManager.delegate = self } pushManager.localizedDescription = pushManagerDescription pushManager.providerBundleIdentifier = pushProviderBundleIdentifier pushManager.isEnabled = true pushManager.providerConfiguration = [ "host": "my_server.local" ] pushManager.matchSSIDs = ["my_wifi_ssid"] pushManager.saveToPreferences(completionHandler: { error in print("error? \(String(describing: error))") print("is active: \(pushManager.isActive)") }) } } In my extension, A PushProvider Target. I have a bundle id com.my_team_name.my_app_name.PushProvider and in the app group name group.com.my_team_name.my_app_name In the Info.plist of my extension, I've added the required configuration: <key>NSExtension</key> <dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.networkextension.app-push</string> <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).PushProvider</string> </dict> the .entitlement file have the same contents as the application. and I have created the extension class "PushProvider.swift" as follow: class PushProvider: NEAppPushProvider { ... } When I run the application, I got this printed out error? nil is active: false I think it might be something with providerBundleIdentifier in Push Manager. Have anyone know what I've missing?
Posted
by BizarreTH.
Last updated
.
Post not yet marked as solved
0 Replies
185 Views
Hello, I've implemented Notification Service Extension as well as push notification in my app. I choose Notification Service Extension as the scheme and then run the whole project. The main app runs well. But when I send a message to my device, I immediately see an alert banner poping up. The content in it has not been modified, which indicates the Notification Service Extension does not work. Also I didn't see any logs printed out from the notification extension. At the meantime, below error messages have been printed out on console under the name of "TestAppPushNotificationExtension" **2022-04-22 00:20:14.818476-0700 TestAppPushNotificationExtension[3594:131852] Bogus event received by listener connection: &lt;dictionary: 0x24e1cbb20&gt; { count = 1, transaction: 0, voucher = 0x0, contents = "XPCErrorDescription" =&gt; &lt;string: 0x24e1cbcb8&gt; { length = 18, contents = "Connection invalid" } } 2022-04-22 00:20:17.797906-0700 TestAppPushNotificationExtension[3594:131852] [lifecycle] WARNING: Did not receive handshake message from the host after waiting ~2 seconds. THIS MAY BE A SPURIOUS LAUNCH OF THE PLUGIN due to a message to an XPC endpoint other than the main service endpoint, or the CPU is highly contended and this extension or its host is not getting enough CPU time. ** I've followed this article(https://www.amarendrasingh.com/swift/notification-service-extension-not-working/) and tried every recommended way to debug. But I still didn't find a way to resolve it...
Posted
by angellan.
Last updated
.
Post not yet marked as solved
0 Replies
165 Views
Hello everyone! I am trying to implement push notifications in my WatchOS app. I have created the delegate class that handles the registration for remote notifications and that allows me to obtain the device token. Then I take the token and send it to Firebase, like this: func didRegisterForRemoteNotifications(withDeviceToken deviceToken: Data) {     FirebaseApp.configure()     var ref: DatabaseReference!     ref = Database.database().reference().ref.child("/")     let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }     let token = tokenParts.joined()      if let userID = UserDefaults.standard.object(forKey: "id") as? String {         ref.child("users/\(userID)/token").setValue(token)     } } Then I am using a Python Script to communicate with APNS. I am using the http library to get access to HTTP2. This is what I have got: payload = { "aps" : { "alert" : { "title" : "Hello Push", "message": "This is a notification!" }, "category": "myCategory" } } dev_server = "https://api.sandbox.push.apple.com:443" device_token = "9fe2814b6586bbb683b1a3efabdbe1ddd7c6918f51a3b83e90fce038dc058550" headers = { 'method': 'POST', 'path': '/3/device/{}'.format(device_token), 'autorization': 'bearer' + 'provider_token', 'apns-push-type': 'myCategory', 'apns-expiration': '0', 'apns-priority': '10', } async def test(): async with httpx.AsyncClient(http2=True) as client: client = httpx.AsyncClient(http2=True) r = await client.post(dev_server, headers=headers, data=payload) print(r.text) asyncio.run(test()) I have also downloaded the .p8 auth key file. But I don't really understand from the Apple Documentation what I have to do with it. What is the provider token in the headers? Am I doing the right thing with the token I receive from didRegisterForRemoteNotifications?
Posted
by tmsm1999.
Last updated
.
Post not yet marked as solved
0 Replies
367 Views
we create an app for iPhones (iOS 11.x). The app recieves remote push notifications and plays an alarm sound on recieveing a notification.The sound is played from an mp3 file delivered with the app.As long as there is no apple watch paired to the iphone the sound is played correctly at the iphone right after recieving the notification and the banner is shown at the iphone screen. But if an apple watch is connected, the sound is not played at the iphone. The apple watch shows the notification but plays only the default sound.The app is made for alerting rescue forces. Is there a way to get around the notification being catched by apple watch so that the alarm sound is played by the iphone? Is there some kind of configuration or are there settings we can use to have the iphone playing the alarm sound also if an apple watch is connected?RegardsJens
Posted Last updated
.
Post not yet marked as solved
0 Replies
235 Views
When a user receives a provisional notification they are given an option to keep receiving notifications or stopping then. If they tap "Keep" they use to get asked if they want them to be delivered prominent or quietly. Well, in iOS 15 (Xcode 13) my users are not getting that choice and the notifications are stuck in "delivered quietly" unless the user happens to change that in their Settings. This defeats the purpose of provisional notifications and I have to go back to the old way which causes the user to be interrupted in the app when I have to ask permission. I am guessing its related to the new Summary feature that recently got added by Apple. What's going on here, Apple?
Posted
by hotngui.
Last updated
.
Post marked as solved
1 Replies
1.1k Views
I am trying to implement the push notifications with APN for my website and keep running into problems with the push package signature. I have followed the instructions as provided by Apple and was able to succesfully run the .php script (after updating it to account for the required intermediate certificate) to compose my push package. Creation of the push package .zip file is succesful and a signature file is generated.On asking the user for permission to send push notifications and when serving the push package I encounter the 'Signature verification of push package failed' error. After several attemps of trying to regenerate the push package as per Apple's instructions I am unable to determine exactly what the cause might be or what is wrong with the push package or signature.Any suggestions as to what I may be doing wrong?
Posted
by DevIncore.
Last updated
.
Post not yet marked as solved
0 Replies
162 Views
Hi, I'm creating an iOS app to assist a user with cooking recipes based on Cooklang files. Cooklang supports setting multiple timers and I want to implement this feature. I use Local Notifications and schedule timers successfully. But here's the problem: my timer notification doesn't produce any sound if phone is in a quiet mode. Does anybody know if it's possible to ignore quiet mode? Or some other way to create timer...
Posted
by dubadub.
Last updated
.
Post not yet marked as solved
0 Replies
104 Views
I was seeing the example that is provided by Apple and I don't really know how to implement the network extension. I searched in the capabilities and I tried to add a Network Extension target but I didn't find the provider type for App Push Provider. I am new in apple development and it is probably that it is a easy way to do this but I didn't find how. PD: I am using Xcode 13.3.1
Posted
by emiliofbb.
Last updated
.
Post not yet marked as solved
0 Replies
147 Views
Hi Team , I am facing an issue with one of the scenario in Actionable Push Notification. Case: On long press of notification , we get two actions "Accept" and "Review". On click of Accept , an api call triggers. If the API call is success we don't have to do anything but if the api call fails , we have to open the app and redirect the user to specific screen on app. There is a option to get the app on foreground on click on Accept Button, since app should not open on click of accept button but it should open when the api call gets fail on click on accept button that option is of no use. Another option I tried is to use openURL method, that also doesn't work when the app is in background How can I solve this ?
Posted
by abhisi123.
Last updated
.
Post not yet marked as solved
0 Replies
144 Views
Currently, I work with CKSubcription and remote notifications. I have a question concerns application(_:didReceiveRemoteNotification:fetchCompletionHandler:) method. In Apple's documentations we can read: As soon as you finish processing the notification, you must call the block in the handler parameter or your app will be terminated. Your app has up to 30 seconds of wall-clock time to process the notification and call the specified completion handler block. In practice, you should call the handler block as soon as you are done processing the notification. Source: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application The method works correctly. My app "wakes up" when got a notification (to observe that, I use option + command + escape). Do I correctly undrestand? - when I call hadler block, should app close immediately? My app closes after 30 second, even if I put only completionHandler(...) in this method. I asked beacuse in the documentation we can read. Your app has UP to 30 seconds Thank you in advance.
Posted Last updated
.
Post not yet marked as solved
0 Replies
115 Views
I'm working on an app that uses NSURLSession to perform a network call from inside a Notification Content Extension, and we're seeing some inconsistent behavior. When the user selects one of the actions offered in the notification, a network request is triggered to finalize the action selection. But we're seeing in some cases that the network request fails. Sometimes it will error out with "The network connection was lost" and sometimes "The request timed out" but there are no network issues so it seems like the failure isn't quite accurate. I'm wondering if there are known issues with using NSURLSession from inside a Notification Content Extension that could cause intermittent problems.
Posted Last updated
.
Post not yet marked as solved
0 Replies
128 Views
Hello, Im not a iOS developer but Im working now with some project from business side. I would ask professionalists if its possible to sending pushes to logged out app users and logged them in automatically when they click on push notification? Is this technically possible ? Is this isnt breaking app store rules? if its secure? have you implemented it already? Thank you for feedback :) Kris
Posted
by bor1904.
Last updated
.
Post not yet marked as solved
0 Replies
268 Views
I am trying to add time sensitive notifications to my task/reminder app, but I am having some difficulty. Here is the code I am using currently: let center = UNUserNotificationCenter.current() let content = UNMutableNotificationContent() content.title = "Productivi" // that's the name of the app content.body = "\(taskObject.content)" //task content content.categoryIdentifier = "TASK_REMINDER" if #available(iOS 15,*) { print("Using ios 15 for set notification") content.interruptionLevel = .timeSensitive } For the adding notification request, that part works, however when the notification shows up, it isn't a time sensitive one. (I was testing in simulator and on my phone both running iOS 15.4) I can't figure out what else there is I have to do in order to enable the feature. I've done everything it says to do, is their an entitlement or capability I have to add. If so, what is it called and can some one please give me detailed steps on how to add that for local notifications in XCODE? Thank you, -Rohan
Posted
by roroCoder.
Last updated
.
Post not yet marked as solved
0 Replies
207 Views
I have an app that uses local notifications and everything is working fine but I'm debating how to handle pending notifications after the user turned off and turned back on notifications for your app. In other words, let's say that a notification is created and it's meant to be triggered on a certain day but the user turns notifications off the day before the trigger date, then he/she deletes the notification from the app (UI) while notifications for your app were turned off and then after a few days later the user turns on notifications for your app again, at that point there may be notifications that the user no longer wants (since he/she deleted them from the UI) and some that have been expired already. How to find pending notifications that were deleted from the UI but not from the notification center in the event described above? FYI - I know how to delete pending notifications and how to compare notifications in the UI vs notifications in the notifications center. What I'm not sure about is when to do the comparison. Is there a way to get notified when the user turned back on notifications for your app so a method can be triggered to find orphan notifications? Thanks!
Posted
by fsdolphin.
Last updated
.
Post not yet marked as solved
0 Replies
197 Views
Recently, when replacing the push certificate, I accidentally put the revoked certificate online. Now it has been replaced with a valid certificate, but an error is still reported. Error reported by the server: ……routines:OPENSSL_internal:SSLV3_ALERT_CERTIFICATE_REVOKED
Posted
by CyanWang.
Last updated
.
Post marked as solved
2 Replies
364 Views
Hello, My aps-environment entitlement is set to development in my app.entitlements file. However when I build my application as an archive (to generate an .ipa file), the aps-environment entitlement is automatically modified to production by Xcode because it uses a Distribution provisioning profile. I read in APS Environment Entitlement documentation that this default behaviour can be changed : But I didn't find a way to do it. Is it possible to change (force) this aps-environment to development even for a distribution build ? Indeed I don't want it to be production as the .ipa is for test purpose only (it is not the Store build). Thank you very much for your help,
Posted Last updated
.