Not Receiving Push Notifications - iphone

previously i had configured my app id for development push notifications it was working fine.
But now i have changed my appid and i have followed the same procedure as stated in the apple docs and i have put newly generated .p12 file on the server side but i am not getting the push to my device now.
i have a doubt for an apple id i generate both development and production ssl certificates and in programme portal both environments shows green balls.
i have created development provision profile after doing as said above. in the sever side do i need to point to production ssl or development ssl for testing.
can anybody have any idea about this

It depends which server are you contacting.
If you are testing on the development side, you have to send requests to the sandbox (gateway.sandbox.push.apple.com) using the appropriate SSL certificate and the appropriated Device Token.
If you are on production/release mode, you have to use the correspondent info.
Another thing that you have to keep in mind is that, for each certificate you have to register your device for push notifications, and if you change the provisioning profile, you have to do everything again, because the Device Token will be different.
Cheers,
VFN

Make sure that the device which you are testing doesn't have both the development profile and the distribution profile. Only distribution (adhoc) profile must be there.

Related

apns push notifications is not working with production certificate

I've enabled push notifications for my App ID and checked in development that is fine, but in production i am not getting notifications.
I used the following code in my server side.
Here are the steps I have followed when switching from production to development:
used the production SSL certificate key
changed the sandbox to false in above blog
I cross checked my distribution provisioning profile which contains key aps-environment and production mode
Is there any thing still I need to change, how can I cross check where I am going wrong?
I already downloaded my app from iTunes portal, but I did keep my .p12 file in my project while archiving, is it necessary?
Device tokens are different for development and production environment. Production device tokens are invalid in development environment and vica versa. You should have maintained different databased for the production tokens and development tokens. Now that you have them mixed it's a bit tricky to tell them apart.
You can find out which device token are invalid in the production environment (which means they are probably development tokens) by sending notifications for all your device tokens. After each send you should try to read an error response from Apple. Error response 8 means invalid device token. You should use a long timeout for that read (since it sometimes takes time to get the error response from Apple).

Create provisioning file for Push Notification

I want my App to support Push Notification, and I do as below:
Generate CSR file
Create an App ID and enable Push Notification
Create Development SSL Certificate for the App ID, using CSR file created in step 1
Create Provisioning file
The problem is, in step 4, I cannot select the certificate created in step 3. Is there anything wrong in my steps?
Thanks.
No you can't select push SSL Certificate while creating provisioning profile. Just select developer Or Distribution certificate.
Upload push SSL certificate in server that provide push service...ex: parse, arban airship. Its optional.
You can't select the SSL certificate just because you don't have to.
The provisioning profile is not related to the push certificate, but to the App ID, that's where you have set your app to use the APN service.
The SSL certificate must be uploaded on your server so it can be identified as your app server when making calls to Apple. You just need to download it, open it in your keychain and then usually export it and upload it on your server.
It's quite simple, just be sure to sign your app with a development provisioning profile when you are using a development push certificate on your server (making calls to apple sandbox server), and a distribution profile when you are using a production certificate.
If you are still getting problems take a look at this guide, it's from quickblox, but the part related to the Apple portal it's the same independently form the server or the service you are using to generate notification and it's really well explained.
follow this it might help you,
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
I also followed all the tutorials mentioned above. I had the same issue with 'step 4'.
What I found out is that I cannot create a provisioning profile manually (using THE certificate). It automatically generates it for me once my Xcode 5 synchronizes with my AppId which was created by myself. So I would like to suggest that you wait a few minutes after you pressing the 'fix issue' button from the general tab. (BTW, I am new to IOS developer.)

Provisioning Profiles + Push Notifications + Production vs Development

I'm building an iOS app that uses push notifications, and I'm finally ready to submit it. Before I do, I'd like to test out push notifications off the Production server, to make sure everything is working correctly. Thus far, the sandbox environment has been working fine.
After doing quite a bit of searching, I learned that switching the servers over from ssl://gateway.sandbox.push.apple.com:2195 to ssl://gateway.push.apple.com:2195 wasn't enough, and that production push tokens are different from sandbox push tokens. Instead, apparently I need a new provisioning profile with Production entitlements, new certs installed on my server, and to re-build my app with said profile so that it knows to create the correct push tokens.
So, after going through all the steps, I can't even make a build run on my phone; XCode says
This profile cannot be installed on devices
Here are the steps I've taken. If I'm missing something please let me know:
In my iOS Developer Center, I've made sure that my AppID is "enabled for production" under the Apple Push Notification Service.
Also in my iOS Developer Center, I've created my Production Push SSL Certificate, gone through the necessary conversion steps, and installed the resulting .pem on my server.
Per the instructions, I've create "a new provisioning profile containing the App ID you wish to use for notifications." I've done this by going to Provisioning, and clicking on the "Distribution" tab, and making a new profile. I've confirmed that "production" is set under the "entitlements" section of this profile.
I've selected the provisioning profile in my project settings. I get the message
This profile cannot be installed on devices
and I'm stuck.
Build an ad-hoc distribution version of your app, and install it on your own device. That will use the production APN gateway and certs.
You cannot install an app compiled with a appstore distribution (production) profile on a device. Only Apple reviewers can do that. you can only test push on an app compiled in development mode and using sandbox server.
If you want to test production servers, you must compile the app using an AdHoc distribution profile enabling the devices you want to do the test. Clearly you must recompile and the send the app for review using the App Store distribution profile.

AdHoc build receives no push notifications

I am developing push notifications for an app of mine, I wrote the provider in PHP and it works fine. I was previously testing the push notifications with my dev builds and the sandbox server from Apple and everything worked fine, now I am trying to get it to work with an AdHoc build but I never receive any messages on the phone. Here is what I did:
Enable production push notifications for the App, create the certificate, download it, create the PEM following the instructions here and upload it to my server. Configured my PHP Script to use gateway.push.apple.com and port 2195 for the connection and test it, the connection to the server works as expected.
The Layout of the payload is the same as with the dev and writing to the stream works
After activating Production APN I recreated my AdHoc provisioning profile and verified after the build that in the entitlements aps-environment is set to "production" (which it is)
Installed the App through AdHoc on a device which has not run the app before, I get asked whether to allow PNs, click yes and my server receives the token just as it should.
Tried to send a message (which should get send to 3 devices) through the production environment. There is no error when connecting to Apple or sending the data but I do not receive a push notification on any of the devices.
I am really out of ideas what could be wrong, does anybody have an idea? Thanks a lot!
I finally figured this out, the issue is that if you open a connection to the APNS and send over more than one push notification AND one of the tokens you submit is not a token valid for this certificate (eg. you send over a token that belongs to a dev instance whilst being connected with the production certificate) the APNS cancels the delivery of all the PNs that you sent in this batch. At least that is what I experienced so far, so make sure you always keep your dev and production tokens nicely separated :)
Push certificates for production and development are different. And to make more difficult device tokens for production and sandbox are different for the same device. Cross check if these are correct and Im sure you must have faltered in this. To get device token in Production mode, write an alertview in AppDelegate didreceivenotifications event.
Once you get this token, you will know that it is different from dev token that we are generating which is why you were not able to send notification on PROD
I am struggling with the same issue. I believe the problem is that with adhoc builds, apple will only send notifications to them from the production apns server, try that.
For distribution and release build always use production certificate.

Push-Notification works on develpoment but not on production

So we have a problem with our app. We put push-notification in, and it works flawlessly in development. Then, once we got on the app store push no longer works. By looking at our server logs it looks like the the registration call is failing and not getting a device token.
Has anyone encountered this before?
Cheers,
Did you create a production push notification SSL certificate? This is most frequently the cause. Applications signed with a development provisioning profile will not work with a production push SSL cert and applications signed with a distribution provisioning profile will not work with a development push cert.
Also, you can create an ad-hoc distribution cert and use this to test your distribution provisioning profile. Since you can't run the build you send to Apple for distribution, I'd strongly encourage you to make an ad-hoc distribution build and confirm that push notifications work in that installation.