Bluemix Push Notification service not working anymore? - ios

I have a native iOS Swift app talking to a Node.js Bluemix backend with MobileFirst services (AMA, Cloudant, Push iOS 8), which worked well for over a month. A few days ago I noticed that I could no longer register new devices from the iOS app (IMFPushClient.sharedInstance().registerDeviceToken() responded with a 404).
I knew that changes had been made recently to the MobileFirst services (e.g. the various push services were merged into one), so I figured I should rebind those services. This resolved the registration issue, but I haven't been able to receive push notifications ever since.
This is what I tried:
created a completely new backend with the "MobileFirst Services Starter" boilerplate
cloned the most recent version of the "Bluelist" sample app and configured it for this new backend
issued a new APNs certificate for my bundle ID and uploaded it to the push service
successfully registered for push notifications on my device. I have verified this by calling the /devices REST API (essentially, I followed these steps).
Now every time I use the REST API to send messages (after figuring out that the bearer token approach was replaced with a new "appSecret" header), I get an HTTP 202, but the notification never arrives. Likewise, when I try to send the message through the service's dashboard, I get a success message, but the notification never arrives.
One thing I noted is that the symptoms stay the same even if I don't provide the .p12 certificate to the service, so I wonder if this might be some certificate issue, but I have no idea how to trace this. Also, IIRC the "old" MobileFirst services required me to provide the bundle ID and version of the mobile app, but this seems to be gone now. Any help is greatly appreciated.

We were able to solve the issue above by making sure the sandbox environment was using a sandbox .p12 file. To verify this setting go to the IBM Push Notification Dashboard and click the Configuration tab:
Here you can see the Certificate Type of the .p12 file you have uploaded. Make sure if you are using the Sandbox environment it is listed as Sandbox. Same is true for the Production environment.

Related

Testing push notifications in development with APNS HTTP/2

I am trying to determine what I need to do with respect to the combination of APNS endpoint (e.g., development or production), Xcode, and Apple Push certificates in order to test push notifications while in development. I feel like I've tried every possible combination, but I must be missing something ...
Background
When using Apple's HTTP/2 APNS endpoints from my "dispatch" server, my app/device does not receive pushes, and I receive a BadDeviceToken response from Apple.
Using the exact same .p12 certificate and deviceToken with the Pusher macOS testing app (which uses legacy APNS endpoints), the pushes successfully deliver.
To complicate this further ...
When using Apple's HTTP/2 APNS endpoints from my "dispatch" server for PassKit pushes, my pass/device does receive pushes.
So ...
Point #3 tells me that my "dispatch" server must be configured properly, because pushes to the Apple Wallet pass cause a response (e.g., I can see follow-on requests to my server's endpoints from the Wallet / the pass).
That said, Apple Wallet is a "Production" app. I suspect that, because my app (from Point #1) is non-production/development, something is different.
.
Question
Has anyone been able to successfully receive -- in Xcode -- push notifications sent to Apple's api.development.push.apple.com endpoint? Can you outline the steps you performed (which certificate from developers.apple.com, etc.)? Thank you!
You should be able to send development push from server:
You need to connect to api.development.push.apple.com:443 instead of api.push.apple.com:443. You can use production certificate for both.
Sending push to production server can not work with development builds - only with a build that is exported with AppStore configuration, but you can't debug those (at least not with Xcode)
If you need to check whether the production endpoint works, you can use testflight
Set development certificate from apple developer portal.
Use either production/test server for communicating with APNS.
Edit your target scheme as follows :
This will ensure that when push notification arrives, control will itself fall in the code. It might seem confusing. But here it is how it works :
- Install app on device and stop the Run process from Xcode.
- Place a breakpoint on didReceiveRemoteNotification.
- Send a push notification to device.
- Xcode will itself start the app and control will go to the above function.

iOS Notifications are not receiving that are sent from the server

First of all may be it will be a duplicate question, but due to curiosity I have asked.
I have an application in which push notifications are used, I have prepared, created all the required things for it and at last I have checked the notifications on this link: https://pushtry.com/. All are working well. NOw the problem is that, when admin wants to send the notification from their admin panel the push notifications are not receiving in iOS device.
I have update all the necessary certificates, pem files, methods for iOS 10 etc, but I don't get received the notifictions from admin panel, as per backend, when we send notifications it shows notification send successfully and showing no error for it. I don't know whats wrong going.
Any sugesstions....
First check all the validations or verifications like certificate, pem file and other things are updated on iOS and backend side. This will ensures that nothing error or fault at both ends.
Now reinstall the app in iOS, Clear all notification ids or apns token table from database. On installing the app, you will see there are few apis token available. Now open your admin panel and test again, it will works correctly.
Firstly I want to confirm which certificate you are used for the app developer or distribution.Because there are different ways for sending the notification for both(developer or distribution). Like I am using php services at backend.When I am using developer certificate my backend developer used 'ssl://gateway.sandbox.push.apple.com:2195', $err,
and when I used distribution certificate he used
//'ssl://gateway.push.apple.com:2195', $err.
Thanks

APN push notifications for chat

I'm trying to add notifications to a private chat app that uses Firebase, unfortunately Firebase has an APN service but it must be configured and needs also a server app to manage it. I'd like to have the user notified when someone is texting him while the app is in the background. The problem is that APN (Apple Push Notifications) requires a server with a certificate and that is ok with me, but I'm looking for a way to send push notifications from an iOS device to another device, I mean device-to-device push notifications and the server has just to relay the messages as they are. In my case the APN server should only relay the messages that it receives from a source device to the destination device. I couldn't find a way to obtain that without writing sever code. I want to use pre-built existing services. Has anybody any idea on how to send push notifications from one device to another without configuring and writing server apps? I tried a workaround using the background fetch iOS feature, but the system si randomly giving my app execution time... and that means that my app could wait hours before being started by the system... so that is not a viable solution. Please help
Ok, probably what I found out could be helpful for others. Actually
what I'm looking for can be directly integrated in the app. You need a library like NWPusher (free on GitHub) which can be imported, and with just a few lines of code and the APN device token you get from the system, it is possibile to implement APN notifications... easily, but most importantly... for free.
UPDATE
Check also APNS framework on GitHub. It's written in Swift 3.0 and it supports the latest features.
You are essentially looking for a messaging / chat API to handle device-to-device communication. You might want to try Pusher or PubNub

iOS Push Notificationss log/history or trace

I'm trying to test Push Notifications on an app which has been developed by other team. We have the app installed in our device and validated (the app is no yet in the App Store).
Connection parameters with APNS server are ok.
We launch our script to execute the Push Notification but we don't receive any notification in our device/app.
Question:
There are any log or trace in APNS of our demands?
Have APNS any history of the Notifications sended and its status ?
Note : We use Adobe Campaign to generate Push Notifications services.
We've tested the flux with an alpha version of the app and worked but now with a RC candidate doesn't work.
Thanks in advance
I recommend to check all these possibilities:
Notification is not sent from server
Try to log apns response to see if this is the issue
Check if apple certificates used are expired
Check if you're sending notification using development or production certificates with the right gateway. As Apple say:
The binary interface of the production environment is available through gateway.push.apple.com, port 2195; the binary interface of the development environment is available through gateway.sandbox.push.apple.com, port 2195.
Notification is sent from server but is not received by device
Check in settings if push notification are enabled for your app
Check if some code is hiding the notification when the app is in foregroud or is working in background
Check if you have installed the right environment application (if you send notification for production you won't receive nothing in a development build of the app)
Check the device token used to send notification
Did your app communicate to your server that it is a staging app and that the script should send APN via the Apple staging server?
Did you also deploy staging certs/keys to your server?
Did you log the response you got from the APN server when your server communicated with it?
Use APN Tester app save my day, thanks "sanandiya viper".
The problem was app's developers don't tell us p12 certificate is production one and we installed it as developer certificate. APN Tester bring us the choice to test booth options.
Thanks for all your answer. Problem solved.

Production push notifications stop working after having previously worked

I’m providing this question and answer because I’ve not seen the problem I ran into with the fairly common ‘APNS not working problem’ and perhaps my experience could help others.
One of my apps that I have in the store uses push notifications. Version 1 of the app was working just fine. No problems.
I created version 1.1, tested it on the sandbox APNS (worked fine) and submitted it. Sometime after 1.1 was approved I noticed push notifications weren’t working. My device was not receiving any push notifications, nor was any other user. That naturally led me to believe I’d screwed up something with the certificates or something like that when I created v 1.1. I checked all the normal things - sandbox vs production, certificates, provisioning profiles, etc. No dice.
--My server setup
I’m doing the interaction with the APNS servers myself and whenever I send an APNS message to Apple I got a positive response. My server code opens a connection to the APNS gateway, sends an APNS message for every device that needs one, then closes the connection.
(this next bit is key to the problem)
In the user record in my DB, I keep track if the user installed the dev version of the app or the production version of the app. I keep this as a flag in the user record. I do this for ease of use.
For simplicity sake, I have one script that processes the development users and sends their APNS messages to the sandbox server and separate code that sends the production user’s APNS messages to the production APNS gateway.
All of that was working fine. I’ll save you all the recertification steps and other grief that I did.
As far as I could tell everything was working fine and everything was set up correctly. So I followed the advice of Ms. Rand: “Contradictions do not exist. Whenever you think that you are facing a contradiction, check your premises. You will find that one of them is wrong.”
After too many hours trying to figure out what was going on I finally determined the problem.
I had turned a development user (my wife’s iPhone) into a production user as I thought she had downloaded the production release of the app
For this user, my server was using the deviceID generated from the development app and sending that to the production APNS server
Whenever I would send that device ID to the production server as one of the APNS messages, even though I would get a positive response from the servers, none of the APNS messages to any other devices would work.
Once I flipped her user record back to be a development device, everything began working again.
I verified multiple times that this was the problem.
So, it appears that using a deviceID that’s intended for sandbox APNS interaction and sending it to the production APNS really screws things up.
Hope this helps somebody in the future.

Resources