iOS 8 - notifications stopped working in new Ad Hoc version - ios

There are many threads already about this infamous error:
no valid 'aps-environment' entitlement string found for application
But the difference is that for me it was working perfectly before, and now the problem showed up again.
We updated the project for iOS8 in Xcode 6, and we created a new Ad Hoc distribution profile (Xcode got rid of the old one somehow), installed the ad hoc build with Testflight as we had before.
I tried to check for any trouble:
bundle IDs are correct
the App ID is properly configured to use notifications in production
the notifications certificate is still valid
the new AdHoc profile claims to have notifications enabled.
Nothing else seems wrong until the 'aps-environment' error (when the device tries to register for notifications). Could the new AdHoc profile mess this up somehow? Anyone has any idea of what can be the conflict?

Xcode 6 seems like automatically generate provisioning profile(XC Ad Hoc : ...) for you.
When you try to export ipa for AdHoc, see what bundle id the provisioning profile is using.
If the bundle id contains wildcard(*), it won't work for push notification.
In my case, I removed wildcard bundle id from my app ID list in certification center, and refreshed profiles from Xcode accounts settings. After that, Xcode generated AdHoc profile with full app ID, and push started working again in AdHoc version.

Related

Xcode 11 Archiving to Generic iOS Device errors relating to registering bundle identifier and iOS App Dev provisional profiles matching my app id

As the title says, I'm on Xcode 11 and trying to archive to a generic iOS device to add a new version of the app to TestFlight. It builds fine on all simulators. I don't believe I can change the bundle identifier as I'm adding an update to an app that's already on TestFlight. See below for archive errors.
Errors:
"Failed to register bundle identifier. The app identifier "com.'myappnameishere'" cannot be registered to your development team because it is not available. Change your bundle identifier to a unique string and try again."
No profiles for 'com.myappnameishere' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.myappnameishere'
What I've done:
A. Gotten an Apple Developer Account and registered my devices
B. Cleared the local Provisional Profiles using this method:
Xcode Error: "The app ID cannot be registered to your development team."
Apologies if this has already been posted but I couldn't find anything. Any help would be appreciated!
If the app is already on TestFlight, you cannot just use any apple developer id, you need to be logged in with the same apple dev account which was used to upload the app to TestFlight before
To archive, and upload an update to the app, you will also need the following installed in your machine
app store provisioning profile for the bundle id
certificate assigned to the app store profile
private key for the certificate's
(or you need to create these artefacts, and install / download them on your machine)
It is not clear if you already meet these criteria.
EDIT: answers to questions in your comment -
You may also face issues running the app on the device if you do not have developer profile for the bundle id, but with free provisioning / wildcard profile, you can circumvent this, and not need access to the specific dev account.
You can create and export archive (generate ipa file) ready for testflight using those artefacts, but to upload the ipa to testflight using any method, you will need credentials for the specific dev account. Alternatively, you can generate the ipa and share it with someone who has access and can upload the ipa.

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.

Initializing my new AD-HOC profile for testing Push Notifications on Production

I want to test Push Notifications in iOS production version before I publish it. I understand I cant sign it with distribution profile ,only AD-HOC profiles.
So I created an AD-HOC profile, selected the right bundle, selected my device that I work with and created a new profile. I downloaded it and after that I select it in:
Provisioning Profile -> Release - AD-HOC-NEW
Provisioning Profile -> Debug (Any SDK, Any iOS SDK) are with Automatic.
It compiles and installed on my device through Xcode but notification don't come.
When I try to change Debug settings also to my new profile I'm getting an error :
"No provisioning profiles with a valid signing identify(i.e certificate and private key pair) were found.
No codesigning identities (i.e certificate and private key pairs) that much the provision profile specified in your build settings ("AD-HOC-New") were found. Xcode can resolve this issue by downloading a new provisioning profile from the member center."
I press "Fix Issue" but It dont fix it...
What could be the problem?
I think you should install your binary not straight xCode but as a real over-the-air/ ad hoc deployement.
The consequence is that your application will request at launch not a token from the sandbox environment but from the production one, and this will match your certificate (which is a production one too).
You do a real ad-hoc deployement both by installing your .ipa through iTunes, or by using a solution such as Testfligt.

iOS - dreaded code signing error (0xE8008016) - push notifications

Well I get this error:
The entitlements specified in your application’s Code Signing
Entitlements file do not match those specified in your provisioning
profile.
(0xE8008016).
I have checked that the bundle ID corresponds to the provisioning profile, and from what I understand, I enabled push notifications correctly for development on my app id profile (in the dev center).
Knowing that I am using push notifications, what do I need to do to resolve this?
I don't have push notifications certified for distribution, just development.
The solution was to first create a new app ID, change the bundle ID in xCode accordingly, and do the push notifications configuration first, before creating a provisioning profile, for both development and production.
Next I created a provisioning profile with the new app ID, and changed the bundle ID in xCode, downloaded the profile, and compiled the app.
Not using the entitlements file - removing it from the build settings did the trick for me. (Thanks Hetal!)

Push notifications don't work if app is installed via iTunes but they do if installed by XCode

I have an app that uses push notifications and I am trying to distribute it to testers for testing.
If I create an ad-hoc distribution which gets installed via iTunes then everything works except for the push notifications, which never arrive.
But if the app is installed using XCode then the push notifications do arrive.
When I build for installation using XCode I set the code signing identity within XCode to my development profile. When I build for ad-hoc distribution I set the code signing identity within XCode to be the ad-hoc distribution profile when building the archive, then sign the archive for distribution again with the ad-hoc profile (I found this was the only combination that would allow installation via iTunes without an error message).
All the devices have been added to the ad-hoc distribution profile and to the apple push profile (and also to the team provisioning profile), the profiles have been renewed and refreshed within XCode.
Even with my own iPhone I can get push notifications to work if I install with XCode but not with iTunes.
Am I signing the ad-hoc distribution with the incorrect profiles, if so what is the correct combination of profiles?
Is there another reason why the push notifications don't work for the ad-hoc distribution but do when the app is installed via XCode?
These are the profiles used:
1) Apple push profile which has an App id of abcdef.com.company.mno
2) Project Development profile which has an App id of abcdef.com.company.mno
3) iOS Team provisioning profile which has an app id of abcdef.*
4) AdHoc Distribution profile which has an app id of abcdef.com.company.mno
5) My developer profile which has an app id of abcdef.com.company.mno
** since first posting this I tried creating a new iOS Team provisioning profile using the abcdef.com.company.mno app id but it made no difference **
The abcdef.com.company.mno App Id is showing Push Notifications for Development as being enabled (which is correct, we are not yet using Production pushes). Also its Development Push SSL Certificate is showing as enabled.
The code signing identities are: first pic what I use for installing/running using XCode, 2nd picture when building an archive for ad hoc distribution.
The description for the iPhone Distribution profile in XCode says: "Ad Hoc distribution profile (for bundle identifiers com.company.mno)".
This morning I had a similar issue trying to compile an In House app (I think it's the same issue). I had the iPhone plugged to the computer and I saw in console one warning like: entitlement 'aps-environment' has value not permitted by a provisioning profile
I tried this solution, but I had no success:
'aps-environment' has value not permitted by a provisioning profile
So, my app was working correctly in release mode running from Xcode, but when I tried to export with Ad Hoc certificate my iPhone shown that message on console.
Finally I went to profiles in iPhone and deleted all. I went to profiles in Organizer and deleted all too. I edited the provisioning profile via Provisioning portal and downloaded them again.
I changed code signing to Don't code sign. Changed again to In House provisioning profile, exported to a file and everything worked fine!
You're probably signing the adhoc version with a wildcard app id provisioning profile. Make sure the Code Signing Identity in the build settings is explicitly using your explicit-app-id provisioning profile.

Resources