Cannot get push notifications with PEM file - ios

I may sound like noob but I faced a problem and not able to find the solution. I searched all over the google and nothing.
Here is the problem.
I have an app that should receive push notifications. Until iOS 10 everything worked perfect, but now I am not able to receive notifications with my PEM file, instead I can receive them with my P12 file, but PHP won't accept P12, so I am stuck.
I have created my pem-s using this thread link
In my app code is written based on this link
One more thing.
I have tested my push notificatoins also using this website http://pushtry.com/ and in case I use PEM file and TEXT mode, I can receive push, but PEM file and JSON mode does not work. P12 works with both.
I don't know what to do. Please helppppp!!!!

I have found a solution, hope it will solve your problem.
First, use this link: http://apns-gcm.bryantan.info/ and follow their instructions , instead of pushtry.com
Implement all the methods related to remote notifications and make sure all these are updated.
If by mistaken or accidentally your app not enabled notifications for background mode then refer this link: https://www.iphonemanager.org/ios-11-notifications-not-working.html
I have followed these instructions and at my end apns is working.

Related

How to send and configure APN Auth Key (.p8 file) in VB.Net

Im facing it difficulty in iOS as well as VB.Net
Not able to find any solutions since yesterday, I am posting it here.
Finding it hard to configure. Any help would be greatful!!
you can use this reference link if you have a curl and openssl with Homebrew version.
Other link to run on Node JS code has all steps of creating the Apple Push Notification Authentication Key and setting up a local server. To run Node JS code for sending push notification link
Let me know if you face any issue.

Push notifications issues: key,failed/message not reach

I'm still new to iOS dev.
And I'm very, very new to whole APNS idea. I followed many tutorials, and didn't go so well.
I'd like to ask some questions.
Can I use same .certSigningRequest file for dev/dist/apns certificates? Does it matter if some of this certificates from this .certSigningRequest have been revoked?
When I export my key in keychain to .p12 file, can I use this one for both dev/distribute version?
If my server open port 2195, by giving .pem generated from above cer, my server should be able to send push message, right?
How can I unsubscribe/unregister from my device and/or from server/apns service? I mean when I need to remove, and try to build&run the code again.
4.1 How does
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
really work? Does it tell apns not to send message/just turn it off? How can my server/provider know if device need to unsubscribe?
I find this tutorial really useful: http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
And here some questions I have about what I encountered.
1. The sample app from the tutorial worked fine, using both my laptop & my server to send a message. But after a few days, it doesn't. (the response is still 'Connected to APNS Message successfully delivered', but the message never reach my device)
What could be the cause? My friend have revoked a dev cert? (I shared acc. w/ my friends) Or I reinstall the app? I also tried method unregisterForRemoteNotifications & register again, but nothing happens.
2. I also tried https://apphq.shephertz.com for a provider. This one requires .p12 key file in their format. (link) I have another project (this one is unity) register apns thru the app. It seems fine since I can see device token & user store in the web. But when I tried to send message, I got an error, like
iOS KeystoreException Device ID : <my-device-token> : Invalid keystore password! Verify settings for connecting to Apple... Does anyone know what this mean?
Sorry for my poor English.

APNS not received after server migration

Our iOS app successfully implemented APNS. Sometimes its not getting received but almost 90% of time its ok.
Now we are required to migrate the whole server-side (which is written in PHP) codes.
After few hours, everything was done and thought migration was completed (all webview was correctly shown, user's data etc.). However, when my colleague try to send push notification to my iOS app, it failed to receive. The server log stating that the APNS was successfully sent and no errors. Interestingly, when he try to send APNS through web browser (hit the URL to send the command), it's successfully received.
Now we don't know where to go from here and don't know what to do. Are we missing some process required in the case like this? For example, should we re-create Certification files for APNS if we want to migrate the whole system? Is there any iOS code at all to modify when the server was migrated? (Other than referral to the server URL. We have already checked that)
I know that the question is too vague but it's just happened and we really can't think of any reason. If there's any guidance for server migration for APNS, it would totally appreciated.
Thanks in advance.
You're right, way too many unknowns to give you a straight-forward answer :)
But, if I understand correctly, when you trigger the PHP from a web browser, the push works. When it's triggered via command line, it doesn't.
Make sure that the user who is executing your script via command line belongs to a group that has enough rights to execute all the statements in your PHP script. For example, if you're using the fwrite command, the user executing the script must belong to a group that has access to the file system.

Ruby apns gem returns nil

I'm trying to get the APNS gem to work with my Rails app. I had originally set this up several months ago, and push notifications to iOS devices worked swimmingly. Now, my app is live and I've found that notifications aren't going out anymore. The APNS gem hasn't been updated in some time, so I've tried various later forks of it, all to the same effect.
Here's what I'm doing:
APNS.host = 'gateway.push.apple.com'
APNS.pem = Rails.root + "lib/push_production.pem"
APNS.port = 2195
APNS.send_notification(device_token, "Test send" )
And the result?
=> nil
There's no feedback from any method, no logfile that I can check. I've tried generating and regenerating my certificate; everything seems okay there. I've tried expressing my device token in various ways, without the angle brackets, without spaces between groups of characters... APNS don't care.
Given the number of moving parts involved in this, I know this is a tough question. But can anyone suggest where to look?
The official documentation says this :
If you send a notification and APNs finds the notification malformed
or otherwise unintelligible, it returns an error-response packet prior
to disconnecting. (If there is no error, APNs doesn’t return
anything.) Figure 5-3 depicts the format of the error-response packet.
So it only makes sense that the gem doesn't return anything, because Apple's server doesn't let it know what it's doing. Also if you look at the gem's github page, the given examples do not handle the return value of APNS.send_notification.
Last time I worked with Apple Push Notifications, it pretty much behaved like a black box, not returning anything most of the time.
I believe I've found the answer. After registering an account with Urban Airship, I tried sending a test message to my phone, and again to no avail. But these guys actually have their act together, so they were able to show me the error message! Turns out my device token was invalid. Why? Because it was generated by the sandboxed version of the app.
Yes, my app is in the store, but it turns out that my App Store distribution profile was generated before the push notification entitlement was added to it. So when you run the codesign tool on my executable, it doesn't show the entitlement. Here's an example:
Diomedes:Release-iphoneos aaron$ codesign -dvvvv --entitlements - Tiberius.app
That command should show a plist that contains the key with a value of "production". My release didn't have that key at all.
I was actually forced to generate an all-new distribution profile in the Provisioning Portal, which finally did include the correct entitlements. I haven't been able to test this yet (8 day App Store review, anyone?) but I feel like this is the problem.
P.S. This article on Urban Airship's site was instrumental in helping me.
This worked for me,
Is your sandbox value correct? Use false for production certificates and use true for development certificates.
P. S. https://github.com/tompesman/push-core/issues/27

Complete procedure to implement APNS in ios application

I am trying to implement the push notification in my application .
For this i searched and i found that when my application is not running in foreground then user can be notified by using APNS . And i read many related articles and blogs for this however i got confused because it is not clearly mentioned how to create the server and where it will physically exist .Also APNS (assuming that it is the service provided by apple )will reside with ios on device.
IF some has link which will clearly shows each and every step involved to implement the APNS then please do tell me ..
Thnx in advnce
Paggggyyy123
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
This will get you the basics..
http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2
the above will get you with the server part..
If you have any problem..do tell ..

Resources