iOS Push Notifications not working with AdHoc Certificate - ios

iOS Push Notifications not receiving with AdHoc Certificate. A different device token is also getting generated and in backend there is no error. But the device is not receiving Notification.

This solved my problem:
While creating Production SSL certificate, do not change the name "aps_production.cer".
And before creating Development related certificates, first create certificates(SSL,provisioning,p12) for only production.
It really worked for me after trying different approaches.

For my case, Xcode picks one of the Provisioning Profiles in my machine even if I set it to the correct one.
What I did is, everytime I export,
(WINDOW > ORGANIZER)
I check the Provisioning Profile in the summary. If it is not the provisioning profile that exists in the developer account, I click the arrow (in the right of the provisioning profile) to see finder then I delete it from my machine.
After that, I tried to export again until I see the correct provisioning profile.

Follow this link step by step....
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1

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.

iOS: Production Provisioning Profile has no devices included

I recently decided to add Push Notifications to my iOS App. I had to create new certificates, then I realised the devices included in the Apple Developer Website weren't up to date. So I had to add my new device with the correct UDID. That's where the issues started. I can't exactly explain all the steps I've taken because I've been constantly deleting and adding new Provisioning Profiles today. Here is the status now:
I have a iOS Team Provisioning Profile, in iOS Development, Managed by xCode, for my app.
Then, I created my own iOS Production App Store Provisioning Profile, but it always indicates that there are "0 devices" linked to the profile. Impossible to add a device. This obviously creates issues in xCode, because whenever I try to generate new archives, or builds, I'll get issues that my device is not included in the provisioning file.
I've tried deleting them all and recreating them multiple times to no avail.
Whenever I let xCode try to fix the issue, it ends up with the Provisioning Profile in Build Settings being switched to Automatic, and the Code Signing Identities ALL switch to "iOS Developer". But that obviously fails when I try to build a Release build of my app.
From scratch, what are the steps to generate a valid iOS Distribution Profile for my app, that includes my device, and that I can use for Push Notifications?
EDIT: I now understand that I can't add a Device to a Distribution Profile and that this is not necessary. Thanks a lot. Still, I get the following message whenever I try to build on my device:
Your build settings specify a provisioning profile with the UUID “...”, however, no such provisioning profile was found.
Xcode can attempt to fix this issue. This will reset your code signing and provisioning settings to recommended values and resolve issues with signing identities and provisioning profiles.
ANd when I click on fix, it switches back to everything I explained above.

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.

APN & TestFlight : Xcode chooses a wrong (XC*) provisioning profile to submit archive

I am using Parse.com to send client push notifications, from one iDevice to another.
It works well with the 'development' setup, i.e. with
- the Push Notification Setting of the appID set on 'Development'
- a development SSL certificate
- a development provisioning profile
With this setup, I managed to send a push notification to myself (sender = receiver = my device).
Now I want to test the communication between 2 different devices. To do so, I use TestFlight (because this is the way I usually send updates to my client).
I followed all the recommended steps to move from Development to Ad Hoc :
updated AppID settings to 'Production' Push Notifications
created a production SSL certificate, uploaded it to Parse Server
generated a new Provisioning Profile set for Ad Hoc Development, and installed it on the iPhone (checked on Organizer Library). This Ad Hoc Provisioning Profile is named : 'PushMyMoving_Push_Production_Profile'
updated the Project/Target build settings under 'Code Signing' to tell Xcode that it should use PushMyMoving_Push_Production_Profile (and the corresponding iPhone Distribution Certificate) for now on.
The issue : the build is successfully submitted, but as soon as it is, Apple sends me this e-mail :
And, naturally, I can no longer receive/send push notifications. Here's what I tried so far :
I opened the PushMyMoving_Push_Production_Profile to see if the Push Notification Entitlement was missing. It isn't. So my guess is that Xcode doesn't submit/archive the build with the right Provisioning Profile, although I'm telling it to do so in the Build Settings!
Actually, I noticed that whenever I submit the build, Xcode automatically selects a wildcard provisioning profile :
I tried to delete all the wildcard provisioning profile from Member Center & my Mac, but (annoyingly!) Xcode automatically re-creates them whenever I refresh the Provisioning Profiles Panel under Xcode>Preferences>Accounts. Is there a way to completely erase wildcard profiles ?
This thread : XCode 6 and Ad-Hoc distribution without XC: provisioning suggests that it can be that the "ad-hoc profile doesn't contain all of the devices on your team" but I carefully checked ALL the devices I have when I generated the Ad Hoc profile.
I've also tried to edit & re-generate, re-install the provisioning profile (a common advice apparently) but Xcode still does it its way.
Any help would be much appreciated! I have been struggling for days, it is really frustrating when the problem does not come from the code !
Thanks
Thanks Rhythmic Fistman for the help. I found the answer today : I was submitting my build to TestFlight with an Ad-Hoc provisioning profile, instead of an AppStore Distribution Provisioning Profile. I had read somewhere that Xcode was creating a Ad-Hoc provisioning profile behind the scenes while submitting to TestFlight, so I thought that the Ad-Hoc profile was appropriate. But since TestFlight runs like the AppStore, not having registered the subscribed devices UDID in advance (as with Ad-Hoc distribution) it makes sense to use a "broader" profile such as an AppStore Distribution Provisioning Profile.
So for anyone using Push Notifications with Testflight, you do need an AppStore Distribution Provisioning Profile. Then Xcode will automatically picks it for the submission phase.
Expunging wildcard provisioning profiles from Xcode and the developer portal can be done, but you can probably fix your problems by explicitly setting your Release Provisioning Profile to the correct Ad Hoc profile in your build settings:
This should stop Xcode getting too creative when Archiving.

no valid 'aps-environment' entitlement string found for application when trying to enable push notifications

I've been reading all the other questions asking about this error and it seems like I've followed their solutions but I'm still having this problem. I removed all the existing provisioning profiles and app ids. I created a new app id that has push enabled. I created a development provisioning profile with push enabled. On the Apple dev site, that provisioning profile has a green "active" indicator next to it. In xcode5, under preferences>accounts, the provisioning profile is listed. Under window>organizer, the provisioning profile appears under my device with the status "valid profile". But the error is still occurring. What am I missing here?
Edit: I want to make it clear that I created my provisioning profile AFTER creating the APNS certificate since that seems to be the most common solution to this.
Of course I figure out what's wrong right after typing a question - the bundle identifier in xcode did not match my appid, and I forgot to update the certificate I uploaded to urban airship after restarting the configuration process.
Looks like you fixed the issue, but I got this issue when I moved to a new machine. Turns out I forgot to bring some certificates from my old machine. I fixed it by importing certificates from old to new.
Steps are:
Export certs on old machine as .p12.
Copy them to new machine.
Double click on file(s) to put them in Keychain Access on new
machine.
In Xcode on your new machine, go to Xcode > Preferences > Accounts, then
refresh the provisioning profiles.

Resources