Xcode 4.6 automatic entitlement not working - "no valid aps-environment" - ios

I'm getting the famous error:
Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x413be0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
I am able to fix it by editing the following file:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/Entitlements.plist
And manually adding the aps-environment key like so:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
<key>aps-environment</key>
<string>development</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
</array>
</dict>
</plist>
Then, Xcode is generating correct Xcent file, which contains the aps-environment key at:
/Users/mySelf/Library/Developer/Xcode/DerivedData/myApp-buauvgusocvjyjcwdtpewdzycfmc/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/myApp.xcent
And running the App on iPhone is able to produce device token for push.
This is the only way I found to fix the issue.
( you may use this info for your own troubleshooting in case you encounter this error )
Now, I have the same project running on another laptop (synced with git),
with the same Xcode version 4.6.
This problem does not occur on that laptop.
Project settings/provisioning profile,etc are all 100% the same on both machines.
( Please trust me on this one )
Did anyone encounter such issue with Xcode 4.6 ?
I should probably open a ticket at Apple's support as well.
Just wondering if another more elegant solution is available.
Update:
The above fix could be sufficient only for devel stage but not for release.

A more elegant solution for overriding the default Entitlements.plist is to make a copy of the default Entitlements.plist that you have editted, and put that in your project.
Then, set the Code Signing Entitlements for whichever target build you are having problems with (in this case I've set it for Debug).
This should then use this plist file for Debug builds (ie when simply pressing Run) and your device will register with the APNs development servers

Related

Apple Pre-Release app submission "Missing beta entitlement"

I was trying a long to give pre-release thru itunes connect, I have created the new Certificate for production / App Id / Adhoc provisional profile against newly created certificate. I was always met with missing beta entitlement during export build thru organizer.
I had tried with Application Loader to send the build to itunes but received warning as below.
"Missing beta entitlement.Your app does not include the beta-reports-active entitlement. If you intend to distribute this build via TestFlight for beta testing, please re-build this app with a newly generated provisioning profile."
Adding Entitlement.plist file was not worked out,
This issue swallowed my whole day, If anyone produce right solution here would be really appreciated.
Try using 'App Store Distribution Profile' instead of Ad-hoc. It will be still in pre-release state. You can add internal testers etc. This worked in my case.
You have 2 known options :
1 - edit your .plist file and add "beta-reports-active" line like below (Value must be true) :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
<key>beta-reports-active</key>
<true/>
<key>application-identifer</key>
<string>youridentifierhere</string>
</dict>
</plist>
2 - If didn't work, for some cases "create brand new provision profile" could work.
This got screwed up by Apple when they merged TestFlight into iTunes Connect. I'm assuming that you have an old certificate still. You need to regenerate your certificates and provisioning profiles and go through the signing process from the beginning.

Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application"

Been Stuck on this one issue for quite a while now. Trying to run the following line:
[application registerForRemoteNotifications];
and getting the error
(via: - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
NSLog(#"Failed to get token, error: %#", error);
})
2015-04-03 16:06:42.753 TownHall[696:169453] Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x17426a1c0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
Tried some of the stuff with the following associated post http://stackoverflow.com/questions/10987102/how-to-fix-no-valid-aps-environment-entitlement-string-found-for-application but little luck.
This includes:
1) Recreating a provisioning profile
2) Recreating ID and checking that it matches and has push enabled
3) Clean and rebuild, etc
4) Creating of new certificates
5) Refresh with Xcode > Preferences > Accounts > View Details (Select your account)
Wondering if anyone has any solutions for this?
Happy to share any other information that people might find useful for solving this problem.
Thanks a lot in advance for help!
Go to your projects Target under Capabilities section, you'll find this error glowing. XCode may suggest to fix it for you automatically.
You'll have to create a two entitlements(AppName_Debug.entitlements and AppName_Release.entitlements) file within your project with the following content:
AppName_Debug.entitlements
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
AppName_Release.entitlements
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>production</string>
</dict>
</plist>
Add these two files under Code Signing Entitlments in Build Settings under appropriate option.
You don't have a valid provisioning profile or team is none
IF you see the error 'entitlement string not found for application', add the aps-environment and development key value pair in the entitlements file like stated above

ERROR ITMS-9000 iTunes Connect

I am trying to upload a phonegap build iOS app to the app store and I keep getting this error
ERROR-ITMS-9000:: "Missing Code Signing Entitlements. No entitlements found in the bundle 'com.fitness.challenges' for executable 'Payload/30DayFitness.app/30DayFitness'." at SoftwareAssets/SoftwareAsset (MZItmspSoftwareAssetPackage)
I have set up my development and distribution provisioning profiles and certificates, and uploaded the cerificate.12 and provision profile to build.phonegap.com
any help be great thanks!
i fixed this by adding -538h to the iphone5 splash screen png file name!
so it was - splash-iphone5-538h.png
that was all that was breaking the upload!
According to this topic on phonegap build support forum there's an error in documentation.
In config.xml as id you should put just your app name and not the reverse style domain id as used in provisioning profile.
EDIT: (16.10.2013, 17:33)
I just discovered that it is rather temporary workaround because to upload APK in play store you'd still need the reverse style domain id.
check your Bundle Identifier.
The bundle id supposed to same with App ID.
I had the same problem and fixed it by making sure all the required icons where there.
I had the same problem in a RE-SIGNED APP, using iResign as the re-signing tool.
Here's an example of an Entitlements.plist file that helped me get my build through to Apple.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>B123RP1C12.com.startup.killerapp</string>
<key>keychain-access-groups</key>
<array>
<string>B123RP1C12.com.startup.killerapp </string>
</array>
<key>get-task-allow</key>
<true/>
</dict>
</plist>

iOS Enterprise OTA distribution Unable to Download Application

I created an iOS app and want to distribute it Over-The-Air. I followed this guide:
http://help.apple.com/iosdeployment-apps/mac/1.1/?lang=en-us#app43ad77ea
The App is signed with the enterprise certificate and contains the distribution provisioning profile.
When I try to download the App onto the ipad (using the technique described in this guide), a square icon with my download icon appears on the screen with the name "Waiting...", then a second later the name changes to my actual application name and then again a second later i receive the error message:
Unable to Download Application
"Your Application" could not be downloaded at this time.
in the guide, there are three troubleshooting tips:
if wireless app distribution fails with an “unable to download”
message, check the following:
Make sure the app is signed correctly. Test it by installing it on a
device using iPhone Configuration Utility or Apple Configurator, and
see if any errors occur.
Make sure the link to the manifest file is correct and the manifest
file is accessible to web users.
Make sure the URL to the .ipa file (in the manifest file) is correct
and the .ipa file is accessible to web users.
I checked all three things and they are fine.
What else could cause my download problems?
As alexey mentioned, too many reasons can cause that message. Apple use it as a "catch all errors".
You can diagnose it through the Console. Connect the device to your desktop and access it either from XCode's Organizer (mac only) or iPhone Configuration Utility (mac and windows). But...
It just ain't that simple! :-(
Console may be far from enough. Sometimes there is no relevant message there.
Then, the last resort is following a checklist. Doing all over from zero again. There are many out there... But following there's my generic and non-detailed checklist for Over The Air distribution, at the moment.
Have a Distribution build - This is the most complicated part, done always on the web, and Apple changes the steps all the time. In general, you need a certificate, an identifier and the provisioning profile. Listing devices is almost always required. My current choice is "Distribution -> In House".
P.S.: If you do want to list the devices, make sure the UDIDs are correct. Many issues reported here.
Set the profile under Project -> Build Settings - Since XCode 5, things changed. Instead of code signing with an identity you can clear all that up and set it under *Code Signing -> *Provisioning Profile. The Identity should automatically change to "Automatic". There's also no more need to manually download files from step 1 and install them. XCode manages that now.
Archive - In Xcode 5, there's no need any more to "Build for Archive". Just archive it. It should show up next on Organizer, and it will take some time if it's a big project. Many errors can come up on this step, but they're almost always related to code compilation and not to OTA.
Deploy - Now in Organizer -> Archives, select the proper archive (should be already selected as the most recent one) click on "Distribute", then Save for Enterprise or Ad Hoc Deployment. May be big wait now. When saving the file, there is an option to "Save for Enterprise Distribution". That is a completely misleading name. What it really does is create the plist file. If you have one already, it's fine. You can even manually edit it, which is generally better. The plist be needed for step (5). Here's a good one:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>http://example.com/app.ipa</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>needs-shine</key>
<false/>
<key>url</key>
<string>http://example.com/FullSizeImage.png</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<false/>
<key>url</key>
<string>http://example.com/Icon.png</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.example.app</string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string>for iOS</string>
<key>title</key>
<string>My App</string>
</dict>
</dict>
</array>
</dict>
</plist>
Distribute - Skip this step if you want to install it using XCode or iPhone Configuration Utility. You're done. This is putting on the file on a web site. "Simply" add a HTML page with a href link such as this:
itms-services://?action=download-manifest&url=http://example.com/app.plist
Unfortunately dealing with web servers is never simple. So also check the server mime-type! I've made a couple PHP files to deal with them, if your server supports php. Just keep your files as they are (the plist, html and ipa) and link to app.plist.php instead:
app.plist.php
$file = fopen("app.plist", "r");
while(!feof($file)){
$line = fgets($file);
print str_replace(".ipa", ".ipa.php", $line);
}
fclose($file);
?>
app.ipa.php
<?php
header('Content-type: application/octet-stream');
$file = fopen("app.ipa", "r");
while(!feof($file)){
$line = fgets($file);
print $line;
}
fclose($file);
?>
Verify - Ensure that all files listed in the assets array are available to download. If any of these files return 404 or such (including the icons) the entire install will fail. You must either (A) make those files available or (B) delete those missing entries from the plist. The icon entries are not required for the download to work.
Here is an example plist with no icons:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>http://example.com/app.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.example.app</string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string>for iOS</string>
<key>title</key>
<string>My App</string>
</dict>
</dict>
</array>
</dict>
</plist>
The file examples are a very important part of the checklist. They have to be 100% correct.
Double check the plist and html files!
P.S.: I'm writing this answer because, in my case, it was a "simple" matter of wrong link on the .plist file. And, as such, it's hard as hell to diagnose. Well, only doing this checklist could I find the error! It was pointing to "another-app.ipa" rather than "app.ipa"!
There are a plenty of reasons to cause this message.
The best way to diagnose it is to connect a device to Mac and look Console for the device in Organizer.
In my case, for example, it was:
verify_bundle_metadata: This app was not build to support this device family
Answering my own question:
The problem was that one of the thumbnails did not have the correct path set in the manifest.plist - so not only the ipa needs the correct path, but also the temporary download icons, otherwise the installation will fail with the mentioned error message.
Another Issue that it could be is that both the .plist AND the .ipa need to be hosted with HTTPS and not just regular HTTP. The software package string should look like below:
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://example.com/app.ipa</string>
Stupid little oversight but it was tripping me up for awhile.
We did experience the very same error message when trying to install an iOS 5+ app to an iOS4.3.5 phone.
Did you also check deployment/build targets and target architecture to match the device(s) showing that issue?
Make sure the casing is matching in all the files. They tend to be case insensitive.
In my case the issue was on my device an older version of same app was installed with same bundle identifier (downloaded from applstore) so now when I was trying to download its new version via enterprise distribution it was doing nothing, no error at all. Delete existing version from the device solved my issue.
I found in console.
installcoordinationd(MobileInstallation)[99] :
****bundleID****:5:11:1:1:Updating PlaceholderMetadata for
****bundleID**** with failure 1 _LSInstallType 1, underlyingError
(Error Domain=MIInstallerErrorDomain Code=13 "Failed to verify code
signature of
/private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.IoCSM9/extracted/Payload/App.app
: 0xe8008016 (The executable was signed with invalid entitlements.)"
UserInfo={LibMISErrorNumber=-402620394,
LegacyErrorString=ApplicationVerificationFailed, SourceFileLine=147,
FunctionName=+[MICodeSigningVerifier
_validateSignatureAndCopyInfoForURL:withOptions:error:], NSLocalizedDescription=Failed to verify code signature of
/private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.IoCSM9/extracted/Payload/App.app
: 0xe8008016 (The executable was signed with invalid entitlements.)}),
source 17>
Here we should look at:
Failed to verify code signature of App.app
The executable was signed with invalid entitlements.
In my case it was because i downloaded enterprise build from amazon. But the provisioning profile, which it was builded with, was expired (figured out in developer console).
Another one with the other purpose:
"This app could not be installed at this time."
UserInfo={NSLocalizedDescription=This app could not be installed at
this time., NSUnderlyingError=0x100cbd3c0 {Error
Domain=MIInstallerErrorDomain Code=64 "Upgrade's
application-identifier entitlement string (BBBUUUU.com.bundle.www)
does not match installed application's application-identifier string
(CCCEEEE.com.bundle.www); rejecting upgrade."
UserInfo={LegacyErrorString=MismatchedApplicationIdentifierEntitlement,
FunctionName=-[MIInstallableBundle
_validateApplicationIdentifierForNewBundleSigningInfo:error:], SourceFileLine=878, NSLocalizedDescription=Upgrade's
application-identifier entitlement string (BBBUUUU.com.bundle.www)
does not match installed application's application-identifier string
(CCCEEEE.com.bundle.www); rejected
Here i just removed the previous version of the app. The error was, because i changed the team for the bundle ID and it was installed the app with previous bundle ID.
Open console with:
Xcode > Window > Devices
Select the device
Expand a console with with a box with an arrow inside of it in the bottom left corner.
Try checking bundle identifier in your XCode and .plist file
In my case I did following to get rid off "cannot connect to dl.dropboxusercontent" message after providing ipa shared link.
1. Removed md5 section from plist
2. Uploaded 512*512 and 57*57 images to drop box, and provided shared link in fill_size_image and display_image in plist.
The first thing to check here is that the device you are installing on has the correct OS for the app your are installing. For instance, if the app is built for iOS 11, and your device has iOS 10 on it, then the app will install but you will see this error "Unable to Download Application".
In my case, there was a problem with incorrect file permissions of the FTP folder and the files inside (manifest, ipa, images). Check that they have 775 (rwx) and that Owner/Group is your owner.
The error in the device console was like "Cannot connect to iTunes Store" or "Failed artwork for bundleID" or "Failed to load placeholder artwork for bundleID". But it's just about the files.

has no valid com.apple.developer.ubiquity-kvstore-identifier entitlement AD HOC iCloud

I'm having trouble with iCloud key value store.
I currently have a core data synced by iCloud working, but I cannot get K-V Store to work
I'm getting:
com.domain.appname has no valid com.apple.developer.ubiquity-kvstore-identifier entitlement
com.domain.appname is the format of my appid, masked for privacy.
This has been around for a while, and I've seen people having this issue and when reinstalling the app the issue is gone, but that won't apply to me. Don't know why.
My entitlements:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>$(TeamIdentifierPrefix)com.domain.appname</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)com.domain.appname</string>
<key>keychain-access-groups</key>
<array>
<string>$(TeamIdentifierPrefix)com.domain.appname</string>
</array>
</dict>
</plist>
If you need anything else just ask, Thank you!
this link worked for me. Try this.
Reinstall the app as well as quit the xcode and restart the device.
It will work fine.
Simply, the error is saying that the com.apple.developer.ubiquity-kvstore-identifier "Key" is missing from the entitlement file which had generated when you enabled iCloud in capabilities. Follow the steps in the screenshot I attached:
or 1. just go to the entitlement file and right click on any row and choose Show Raw Keys/Values
When you hover over Entitlement File row (at the top), a plus button will appear.
Click it and drop down list will appear, choose com.apple.developer.ubiquity-kvstore-identifier and for the value just copy and paste this $(AppIdentifierPrefix)YOUR_BUNDLE_ID
Clean. Build. And Enjoy.

Resources