Device token Changing after exported as ipa - ios

Hi Everybody i'm working with Apple Push Notifications for my app here i'm struggled with Device token issues & not getting Notifications.
i successfully created a .p12 key then i uploaded in Amazon SNS it working good and i'm receiving notifications also.
ISSUE Not getting notifications for exported ipa.
When i run with xcode it giving some device token(ex. xxx1111).after i uninstalled the old one,i exported as ipa,& uploaded in diawi.com then run it in same device it gives some different device token(ex. yyy2222). now i copied that new device token(yyy2222) into Amazon SNS with same .p12 key only, now i'm not getting any notifications.
But i deleted the app installed from diawi.com again i run it from xcode then i send the notifications with old device token(xxx1111) it getting notifications.
what is my mistake? help me pls.

TL;DR You've probably not uploaded the production APN certificate to your APN provider.
If the version of the app you run from Xcode works, but the exported version does not, then maybe you've only set up the development APN certificate in your APN provider. The exported app (be it Ad Hoc or Enterprise) is going to use a production certificate, so your APN certificate should be production too.
If you haven't created the production certificate, go to Certificates, Identifiers & Profiles in the developer portal, click on Production and choose Apple Push Notification service SSL (Sandbox & Production):
p.s. The token should change between development and distribution versions of the app.

Related

Parse notifications not working with AdHoc provisioning profile

I know this question has been asked a few times but I am still having issues after trying all the suggested fixes.
I have an app that is being tested through Apple's TestFlight of which a number of External Users have downloaded. The app was built using an AdHoc Distribution Profile against the relevant App ID which has Push Notifications Enabled for Distribution and has the necessary Apple Push Services certificate. I am using Parse and am able to receive notifications on my test device (signed with the dev certificate and APN push cert), however the external testers are not receiving any notifications.
I am using Parse and can see in the logs that the notifications are being sent so I am assuming it is something with the devices themselves related to a problem with the provisioning profiles. I also followed the steps to uploading a new .p12 file to my Parse server for production notifications.
However, it seems that only the builds with the development profile are able to receive notifications. Am I correct in assuming that this is because the certificate used by Parse to sign the notification doesn't match that which was used in the adhoc build? I.e. Parse is still using the old .p12 certificate?
When I uploaded the new .p12 file to my Parse server I didn't explicitly remove the previous .p12 certificate, do I need to do this? Would revoking the dev APN certificate solve this?
Any help is much appreciated.
Thanks
The reason notifications were not being received was due to the production flag not being set to true when I uploaded the production certificate to my Parse server. I re-uploaded the certificate setting this to true and notifications began to work.

Google Firebase Push Notifications for iOS are not working in production environment

I'm using Google Firebase Cloud Messaging API (FCM) to send push notifications to my iOS app.
I could get push-notifications working successfully when I test the app on a device with Development provisioning profiles + development push notification(sandbox) certificates.
However I'm unable to get it working on production environment. I made an ad-hoc build with correct production provisioning profiles and production push notification certificates. And synced an IPA file to a device via iTunes for testing (not directly from xcode). Still I can't receive push notifications from firebase console.
I have uploaded correct development and production certificates (with private keys) to firebase as well. I've double checked every possible step that could go wrong but, still can't find the issue. Is there a way to troubleshoot this issue? Or isn't it possible to get production environment notifications to an AdHoc build?
I had the same issue. Apparently there is an error in the Firebase documentation. When you exporting the APN certificate for production from your keychain to the .p12 file you have to select the actual certificate, not the private key.
Make sure you upload to the Firebase console this .p12 file in the Cloud Messaging APN certificate settings.
Had same issue. Finally got it working by:
Using the correct Project and Target Build Settings as mentioned in This link.
And revoking the existing push certificates and creating a new one completely, and then uploading the new certificate's .p12 file to the Firebase Console.
What fixed my issue was using the new Authentication Keys method instead of the old p12 files. You can read more in the Firebase documentation, just follow their steps and you should be fine.
I had the same issue.
What helped me: adding APNS for Distribution Certificate to Firebase. Simple as that ;)

development push notification works. Production does not

I created a production and sandbox APNS certificate (one for both like apple says i can) but it only works when i use the sandbox gateway.
I have created an ad hoc provisioning profile (so i get a production device token when running the app) and archived and exported the app with that provisioning profile and my ios production identity (i just have them set in xcode before archiving).
I added it to my ipad but nothing happens when i send a push notification.
When i just install the app using xcode (getting a development devicetoken) i can send a push notification no problem using the sandbox gateway.
i looked at the ad hoc provisioning profile and i see 'production' under aps-environment.
I don't think i am missing anything but here we are.

APNS not working on AdHoc Distribution Profile on Google App Engine

After push notifications were successfully sent and received using general iOS Development and APNs Development iOS certificates, I created iOS Distribution and APNs Production certificates for AdHoc testing.
At first, i created an iOS Distribution certificate and installed it to the Keychain. Then I created APNs Production certificate, installed it to the Keychain, and uploaded .p12 file to the server. Finally, I created provisioning profile and signed it with an iOS Distribution certificate. But when I created and ipa-file and installed it on device, push notifications are not received.
Device asked for permissions and i got a unique device ID, server side is fine.
Had anyone faced that problem and what guide/tutorial followed?
I followed this article
http://gnuromancer.org/2013/04/21/google-app-engine-apns/
The issue was with Google App Engine server.
ApnsService service = APNS.newService()
.withCert(inputStream, "password").withSandboxDestination()
.withNoErrorDetection().build();
If you are about to create AdHoc or AppStore build, along with different certificate and provisioning profile, the withSandboxDestination() line has to be changed to withProductionDestination().

Push notifications not coming when we download the build from testflight or diawi iOS

I have successfully created the .pem and .p12 file by
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
Tutorial.
We are using java as a server so I also exported my .p12 key using this link as there was an error of directly exporting the .p12 file
Cannot send push notifications using Javapns/Javaapns SSL handshake failure.
Everything is working great in debug mode. Whenever I install a build by xcode I receive the push notifications successfully everytime. But after archiving and uploading the build on testflight or diawi and then installing it on the device I didn't get any push notifications. I am successfully getting the device token from apns server. On debugging at server side we found that the device token they receive and send the notifications is invalid. This response is sent by the apns server to our java server. . I am using Xcode 6.0 or later and my app is compatible with ios7.0 or later. And yes I have made checks in registering for remote notifications for ios 8 and 7.Has anyone has faced this issue because earlier in xcode 5 series this hasn't happen. Please help
Any help will be appreciated. Thanks
If you followed Ray Wenderlich's tutorial and you made everything work in development mode, the issue most likely comes the fact that you now need to create a new .pem-file for production mode.
So, you need to perform exactly the same steps that you did with the development certificate (i.e. the .p12-file) you downloaded once more with the production certificate which you can obtain in the iOS dev center as well:
Here is the quote from the tutorial that you probably overread:
If you’re ready to release your app to the public, you will have to
repeat this process to make an Ad Hoc or App Store distribution
profile.
1.)Check if the pem file you have stored on your server is created by using a development certificate or distribution certificate, for push notifications to work through ttestflight you need to create a pem file in the distribution mode,
2.) also check if the gateway you are delivering to is gateway.push.apple.com:2195, and not the sandbox one,
3.)the notification tokens are also different for development and distribution profile, check all these scenarios and see
In order for push to work you have to use the exact same AppID for both creating APNs cert and Provisioning Profile. Wildcard profiles cannot be used for push notifications. May this be your problem(using wildcard or just different AppID for TestFlight/diawi)?

Resources