Sandboxed APNS environment & .mobileprovision file - iphone

Anyone know the details of .mobileprovision file? I have an app which I want to point to sandbox APNS environment, I believe I need to create a .mobileprovision file for sandbox environment. Do all the devices which will use my distribution build needs to install some provision profile in order to receive the Pushes from sandbox APNS environment?

You need to have a separate development and distribution certificate for you push server as well as signing the app with different development and distribution certificates that are associated with an appID that has push notifications enabled.
Note that if you are testing (Ad Hoc) then you also need a distribution certificate specifically for ad hoc distribution (you can generate this from you apple developer site).
Finally, this guide helped me create the certificates I needed for my push server.
http://code.google.com/p/apns-php/wiki/CertificateCreation
Also, here is the apple developer page talking specifically about the different certificates required for sandbox and distribution builds for push notifications:
https://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html

Related

Using sandbox APNS on AdHoc Distribution Builds for iOS

I've been reading a bunch of Apple's docs, as well as many other SO questions, but haven't found the answer to this particular question.
I have an existing workflow in place for generating AdHoc Distribution builds for QA members and beta testers. Now that I've added support for push notifications, I'd like those notification paths to be able to be tested as well.
I'm under the impression that Developer builds, signed with a Development provisioning profile, generate tokens that for the sandbox/development APNS environment, and Distribution builds, signed with a Distribution provisioning profile (whether that be destined for AdHoc Distribution OR AppStore Distribution), generate tokens for the production APNS environment. I believe this can be confirmed by opening the different .mobileprovision files, and examining the aps-environment key.
I'd like to know if there's a way to have my AdHoc Distribution builds use the sandbox APNS environment, rather than the production APNS environment.
If I really wanted QA and beta testers to use sandbox APNS, would I have to somehow find a way to allow them to run development builds, rather than distribution builds?
Or are my assumptions about the way things work way off base? (referenced this post and this post)
I did found some mention to AdHoc in the context of APNS environments :
Note: There is a separate persistent connection to the push service
for each environment. The operating system establishes a persistent
connection to the sandbox environment for development builds; ad hoc
and distribution builds connect to the production environment.
It's taken from Technical Note TN2265.
I guess this note confirms that you can't use the sandbox env in AdHoc distribution.
Apple uses a different server for:
Apps signed with a Development profile
All other profiles (AdHoc, InHouse and AppStore). These are going via a Live Server.

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.

Problem with Iphone distribution provision profile

I have a problem
There is one iphone software product of our company
and this product can recieve push_notification messages from our push_notification server
this product is going to be on live(namely it is going to be in the APPSTORE)
so recently we are doing some testing work,(the product use developer provision profile,and the server use the development certificate),it works well
but we want to test the product in the REAL Environment
the server should use production certificate ,
the iphone side product should use DISTRIBUTION PROVITION PROFILE
Now the problem is
1.how to install the product in the device using the DISTRIBUTION PROVITION PROFILE
instead of developer provision profile.
2.if I use the DISTRIBUTION PROVITION PROFILE,can i recieve the push notification message
I am now online waiting for your anwser
thank you all
You can only install builds that have been built for ad-hoc distribution on your device. Builds for app store distribution will not run on any device, unless approved and installed through the store, as their only purpose is being submitted to the app store.
1: Just build your app using an ad hoc provisioning profile. Delete previous versions of the app on the device. Install the ad hoc build and the ad hoc provisioning profile.
2: I have not tried that, but I think this should work, provided you're using the push enabled app-id for your ad hoc provisioning profile and the ssl key and certificate have been installed on your notification server.

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.

what kind of certificate do I need to test apns using ad-hoc distribution?

I can't understand from Apple's docs if I need a production certificate or a development certificate...
You need to create a Distribution Certificate. The Distribution Certificate are used for creating Distribution Provisioning Profiles. Which will allow you to do the following:
Create an Ad-Hoc version of your app (this is used if you want to distribute to beta-users, testers, etc (this is what you want))
Create an App Store version of your app (You'll do this once you're ready to submit it to the App Store)
Below are the Apple steps on how to create an Ad-Hoc version of an app
Ad Hoc distribution allows you to share your application with up to 100 iPhone or iPod touch users, and to distribute your application through email or by posting it to a web site or server. To prepare your application, the following steps will need to be completed.
Create and Download an iPhone Distribution Certificate
Create and Download an Ad Hoc Distribution Provisioning Profile
Build your application with Xcode
Share your application file and the Ad Hoc Distribution Provisioning Profile with the owner of each device
Recipients of the application will need to drag the application file and Ad Hoc Distribution Provisioning Profile into iTunes, then sync their iPhone to iTunes to install
Hope this information points you in the right direction. If you need additional details or walkthroughs just let me know.
The SSL certificate you need is for production when you're building with a distribution provisioning profile. As far as push (apns) is concerned, ad hoc == app store. This is quite helpful, as you can test how push will work in the app store build by building an ad hoc app and using the production certificate.