Provisioning Profiles + Push Notifications + Production vs Development - iphone

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.

Related

Do I need to rebuild and deploy the build again after expiration of provisioning profile?

My Enterprise application is having more than 1000 users in production. Yesterday my provisioning profile got expired. From yesterday I got many calls of users that they did not able to use their app.
Is there any way so that the existing user don't need to install the new build again. Because its very difficult to tell more than 1000 users to reinstall the app again.
Please help me. The issue is with production.
Unfortunately, you will need to get the new provisioning profile on the devices somehow. The provisioning profile must get on the device, and you can simply provide the new profile by itself, or you can rebuild the app and the profile will be included in the app's payload.
There are a couple of ways to do this, but here are the most popular methods:
If the devices are managed using an MDM product, you can push the new profile out to the devices using the MDM capabilities. Again, you can use the MDM system to push just the provisioning profile, or you can push the new app build with the new provisioning profile. Judging by the fact that you would be requesting users to re-download the app, I don't believe you are using MDM to manage the devices.
If you have older devices (iOS 7 and before), you can have the user manually install the new profile. You can email the provisioning profile to the users, and they will be able to open the profiles on their device. Or you can host the profile on a web server and direct the users to open the link to install the profile. The app will then work with the new, valid profile.
Rebuild the app and re-distribute. When the users download the app (or any other apps built with the profile if you are using a wildcard identifier on your profile), the new profile should replace the other one and the app will be able to launch.
Unfortunately, all of these methods require you to get the new profile downloaded from the developer site onto each of those devices.

Push Notifications wont work on distribution

Ok now I have a problem with the push notifications. I have set them successfully for the developing part and I was receiving them on my device. Now I have the application on app store and I cant receave notifications.
This is step by step what I did:
-I have created a provisioning profile for distribution and connected it to the app id that has push notifications for distribution and development.
-I have built the app for distribution with that provisioning profile.
-I have submitted the app on app store.
-Now I have 2 certificates in keychain access Apple Production IOS Push Service:AppID and iPhone Distribution:CompanyName
-I have made .pem file from both and tested it with both. No notification has arrived
I really have no idea what to try and how to fix this.
I have had similar problems, just a few weeks ago. For me the case was that I had several provisioning profiles left in xCode. So what I needed to do was:
Go to Organizer -> Devices -> Provisioning Profiles
Select my distribution profiles for the app in question, and delete them.
Go to developer.apple.com/iOS
Go to the distribution profile, modify it.
Just clicked "select all" (so I could re-save it with no changes), somehow the profile needed to be re-created AFTER enabling the Push certificate
Download the new profile and install it to xCode
Clean project under Product -> Clean
Now I made a new release and tested it and it worked. Maybe this workes for you as well.
Edit
The red-thread in this answer is that when Push notification in the App is enabled, the provisioning profiles need to be re-done (even though, to the eye there are no changes).
If using Parse, make sure you have uploaded your iOS Production Certificate. I ran into this issue and discovered a week later that I had only uploaded my iOS Development Certs to the server.
Settings > Push > Apple Push Certificates
You need to see something that has a Certificate Type of iOS Production with a valid expiration date.

Why not use development provisioning instead of ad hoc?

I was under the impression that when you use a development provisioning profile for a build of an app, only the specified developers can deploy that build to a phone.
But I just deployed a build that uses a development profile to a phone using Xcode Organizer, even though I'm not one of the valid developers for that profile. One of my colleagues, who doesn't even have Xcode installed, did the same with his phone using iTunes.
In that case, why not use a development provisioning profile for distributing your app to e.g. your QA team, instead of ad hoc distribution?
EDIT: Please read the part in bold carefully before answering. I'm not asking a basic "how does this work" question. I've made a lot of development, ad hoc, and app store builds, and now I find that I seem to have made some wrong assumptions.
There's one situation in which you need an Ad Hoc profile, and that's when you want to test Push Notifications.
If you test Push Notifications on a Development Provisioning Profile, your push notifications need to be sent using the Development Push Notification Certificate for your SSL connections to Apple's sandbox APNS server.
If you want to test Push Notifications using your Production Push Notification Certificate and the live APNS servers, you'll have to deploy your app to a device using a Distribution Certificate and Ad Hoc Provisioning Profile (which includes doing the Entitlement.plist steps, which you can ordinarily skip if you were only using Developer Provisioning Profiles).
Also note that when you deploy using an Ad Hoc profile, your device token will be different from the one you use when you're using the development profile. This the recommended way to test APN because there's no back end changes that need to be made between the Ad Hoc build and the final live deployment on the AppStore.
Ad-Hoc is not for developers, but for testers. Who do not have iPhone SDK / XCode, iTunes only.
(The answer is: you can install ad-hoc app without developer certificate, and can't do it with development app)
Method 1: Install from XCode
The Development Provisioning Profile requires you to run the app (initially) from within XCode.
This has the side-effect of marking the device as being used for development, but also requires you to connect the iPhone/iPod Touch to the machine running XCode. Once you run the app from XCode, the app is installed on the device and you no longer need to be connected to the machine to run it. (Until you want to update the app.)
Method 2: Install from iTunes
An Ad-Hoc provisioning profile allows you to give the app to anyone and let them install it themselves using iTunes. You send them:
the app, and
the Ad-Hoc Provisioning Profile
They select these two and drag them onto iTunes. Then sync.
Later, you can give them an updated version of the app only (without the Ad-Hoc Provisioning Profile, since they've already installed that on their device) and they can drag the new app onto the iTunes icon to install the new version.
One limitation to Ad-Hoc distribution, is that it requires you to enter each Device ID into the iPhone Development Portal. And there is a limit to 100 device IDs per year (you cannot erase any IDs, until your next year begins -- only add them). The 100-ID limit will not be a hindrance for most developers, just keep in mind that you need to get the device ID ahead of time, before you create the Ad-Hoc Provisioning Profile to send to the person you want to install your app.

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.

Not Receiving Push Notifications

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.