Unable to test Production Push Notifications through AdHoc - ios

I'm following Parse's Push Notification Tutorial for setting up my Parse app to now be able to send Production push notifications, rather than Development ones, so I can get it ready for the app store. This is covered in section 7.1 in the tutorial.
When I attempt to create an AdHoc provisioning profile, it only works if I create an iOS distribution certificate, when I create an APN production certificate, which is the correct one for this purpose, it shows me this:
If I decide to go ahead and use the iOS distribution certificate from this list instead:
The provisioning profile is successfully created, but again, it's not using the correct certificate for push notifications. Likewise, because I had to use the distribution one to create the profile, I therefore would have to use the certificates .p12 file when connecting my Parse Notification settings to this profile. When I attempt to do this, I unsurprisingly receive the following error:
because I'm uploading the .p12 of an iOS Distribution certificate, and not the APN Production iOS certificate. When I try uploading the .p12 of the APN Production iOS certificate to Parse, it works, but my test iOS device doesn't receive push notifications, because the provisioning profile doesn't use that certificate, as I mentioned earlier.
Am I following the directions incorrectly? Why can't I make a provisioning profile using a Production APN certificate, so that it can work with Parse Push Notifications?

I have never used parse, but you have two exact production certificate.
This is an issue, revoke one of them and try again should work!
the provisioning profile doesn't use that certificate
I think you are misunderstanding what you need to do:
delete the app from your device
Build your app signed with distribution certificate
Install the ad-hoc version of the app on your device
Here is an image to illustrate how the provision profile works:
It's a good idea to check apple docs out
Also very important to check which provisioning profile you have used to sign and build the app.

Turns out my error was forgetting to set the code signing settings in both Project AND Targets.

Related

Create provisioning profile for testing push notifications

I'd like to test my push notifications feature on iOS. I'm working with DevExtreme, a framework based on phonegap.
Following what I made in the past, I made the following steps:
Create the certificate. Here, I chose the "Apple Push Notification service SSL (Sandbox)" option. First question: is it right? I will use FCM.
Create the APP id, enabling push notifications
I need to create a template of my app, so, I need also the Provisioning Profiles. I try to create it selecting "iOS App Development" when creating it. Then, I can't see the created certficate.
What I tried to fix the point 3 is create another certficate selecting "iOS App Development" using the same certSigningRequest as point 1. I created a provisioning profile lined to this certificate. When building the template, I tried to use this file as provisioning and the certificate of point 1 as certificate, but I'm getting the error "The default keychain doesn't have an identity matching".
So, now I'm stuck here, because I don't know how can I test my push notifications feature on an iPhone device. Any ideas?
UPDATE:
Now,I'm trying to do the following: create the APN certificate and use it only for the upload to FCM. Then, create the certificate and profile for the as usual, selecting "iOS App Development" when creating the certificate and link it to provisioning profile.
Is my idea right?
UPDATE: Summarized all the steps here: https://programmingistheway.wordpress.com/2017/07/19/devextremephonegap-how-to-manage-push-notifications-with-fcm/
It’s because you are mixing up the 'Distribution Provisoning Profile' with the 'Development Provisioning Profile'.
Remove old provisioning profiles from your keychain and follow these steps.

How can we test ios release app. in device with wildcard provisioning profile

Currently, I have following config in my Xcode.I am trying to test app. Directly in device with Notification enabled i.e APNS
i) Code Signing Identity as "iPhone Distribution"
ii) Provisioning profile as Wildcard
Question 1 : Can I install through iTunes directly in my device after archieving ?
Question 2 : Will WildCard provisioning profile create release/debug build ? Does this wildcard concept have anything to do the release/debug ?
Question 3 : Without Testflight, is there any way where I can test my app. in release mode directly in device ?
Help is appreciated !
I am stuck here.
A provisioning profile for a wildcard App-ID does not give the Apple Push Notification entitlement.
You need:
An app with the aps-environment entitlement set to production. If you want to test with the APNS sandbox environment this should be set to development.
A provisioning profile for your App-ID that includes the permission to install apps with the aps-environment entitlement set.
A code siging certificate and private key that is included in the provisioning profile.
To check an apps entitlements you can run the following command:
$ codesign -d --entitlements :- path/to/Payload/MyApp.app/MyApp
....
<key>aps-environment</key>
<string>production</string>
....
To check the entitlements in a provisioning profile I find it easiest to open the profile in TextEdit.app (drag the file to the dock icon) and search for “Entitlements”.
The setting for the code signing certificate can be checked at the Apple developer member center.
The answer is pretty simple:
Whatever you export/release you App with the Distribution profile, it will count as "Distribution", thus, it will match the production APNS certificate in your sender. Regardless how do you install or download the ipa.
e.g. TestFlight.
Otherwise, if you export/release/share your App using the Developer profile, it will count as "Developer" so you may use the Sandbox Developer APNS certificate in your sender.
e.g. You install the App in your phone trough XCode.
You should not use a Wildcard provisioning/certificate.
So pay attention to the signing of the App, that will give you the clue about which certificate you need to pair with.
I do this frequently and I switch my certificate in the Push Notifications sender (the one should match the APNS certificate) back and forward.
Let me know if you need further clarification.
Question 3. You can test Push Notifications in all possible case scenarios, Ad-Hoc, iTunes, TestFlight, direct install, you just need to pay attention to the certificate using for exporting/installing the App and sign it properly (as I just said).
Happy coding!

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.

Why doesn't Xcode recognize my push certificate?

I've just finished my app, and so I am now getting ready to submit. But I need to change my developer Push certificate to Ad Hoc to test it with a Production Push certificate.
I thought I had it all figured out, but when I build the app, I get the error:
"Failed to get the task for process 2023" (The number changes every time I build.)
I have created my provisioning profile, and I am able to navigate to my Project's Build Settings and set the app to use my Ad Hoc profile. However, when I attempt to set my Code Signing Identity to "Apple Production Services..." all I see is my Distribution Certificate, not the Push Certificate.
What is going wrong?
I found the problem. I actually did have everything done correctly the first time. I just didn't know that I couldn't build on my phone through Xcode using an Ad Hoc provisioning profile.
So I ended up testing it by downloading the Beta via iTunes.
First of all, when you transfer all the Development Certificates to the Production you cant build the project from Xcode.
No one see push certificate in code signing identity.
You only see Either Development certificate or Distribution certificate depending upon the provision profile you have selected. You don't have to worry to choose Push notification certificate in Xcode, coz its managed by Apple once you enabled the push Notification service to the app by enabling it with unique bundle identifier in developer account. https://developer.apple.com (Only you have to give the merged version of that APNS certificate and distribution certificate in .pem format to web developer )
For Adhoc You have to generate Ipa of your project form xcode and install in you mobile through external link like http://www.diawi.com, if you import Ipa into your device from iTunes remote push notification will not arrive.

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().

Resources