Warning in Xcode that won't go away! (Entitlements with FileProtection) - ios

Hey just became a new iOS developer and everything is fine and dandy so far but I have a warning in Xcode for my .xcodeproj file and it says "Validate Project Settings - Update to recommended settings." When I click on it I get a window that says "Target '(my app name)' - Upgrade DataProtectionClass Entitlement. Upgrades the default file protection level for your application to the recommended value: NSFileProtectionComplete." So I go ahead and click on perform changes so it can do that and the warning goes away but when I try to debug on device I get the error "The entitlements specified in your application's Code Signing Entitlements file do not match those specified in your provisioning profile. (0xE8008016).
If I remove the entitlemnets file which upgraded the default file protection to NSFileProtectionComplete then the wanring in Xcode goes away and it is able to compile and run on the device but then I have the issue of having a warning in xcode that doesn't want to budge.
This happens with a brand new project as well. I'm running Xcode Version 4.4 (4F134) on OS X 10.8 Mountain Lion DP3 (12A178q).
In terminal I went ahead and looked at the entitlements of my .mobileprovision file. (not the wildcard one, but the one with the specific app id)
security cms -D -i /pathto.mobileprovision
And I got this value for the Entitlements key.
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>GLAMURY37G.com.ionescuac.GPS-Status-</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>GLAMURY37G.*</string>
</array>
</dict>
When I built the app in xcode for debug configuration I went ahead and looked at it's entitlements with
codesign -d --entitlements - /pathtoapplication.app
And got this back
<dict>
<key>application-identifier</key>
<string>GLAMURY37G.com.ionescuac.GPS-Status-</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>GLAMURY37G.com.ionescuac.GPS-Status-</string>
</array>
</dict>
And it matches so as expected xcode can run the app on the device. But, xcode is telling me to upgrade to FileProtectionComplete so I do that and then after building my app and checking the app's entitlements again this is what I get.
<dict>
<key>DataProtectionClass</key>
<string>NSFileProtectionComplete</string>
<key>application-identifier</key>
<string>GLAMURY37G.com.ionescuac.GPS-Status-</string>
<key>get-task-allow</key>
<true/>
</dict>
Which makes it NOT match anymore so then I get the error in my first post. If I sign it with the FileProtectionComplete entitlements then xcode gives no warning but it can't run anymore. If I build it without the entitlements then it will run but xcode will keep nagging me with this warning that the FileProtection entitlements should be upgraded to their "recommended settings."
Kinda stuck in a catch 22 situation. Before I joined the developer program I messed around a lot with the simulator and never had any entitlement issues with xcode saying that they needed to be added to the build.

Related

Ipa - entitlistments problems

We have received a Ipa file from a developer, and want to resign it with our own distribution certificate.
That part is quite easy from the terminal.
I tried to install the app afterwards through apple configurator 2, but can see on the device log that "the executable was signed with invalid entitlements"
If I check the mobile provisioning I can see it has been certified with my company ID that I did. But checking the app entitlements, it still stand with the external companies info
Anyone have a clue how to change this
Add --entitlements to your re-sign ipa command to sign with entitlements.
codesign -f -s "iPhone Distribution: Developer (ABCDEFGHIJ)" --entitlements entitlements.plist YourApp/YourApp.app
You can find the entitlements from your app and modify it.
...
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>ABCDEFGHIJ.com.yourapp</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
</dict>
</plist>

Xamarin iOS app "does not contain the correct beta entitlement" despite the beta entitlement flag being part of the provisioning profile

As the original TestFlight app will be retired in a month, I am trying to get to grips with the iTunes Connect Beta system, which looks like a significant improvement. As directed, I regenerated my provisioning profiles and redownloaded them on my build server.
I then performed the build with the "AppStore|Release" profile and I saw this message in the log:
codesign -v -f -s "XXXXXX" "--resource-rules=/.../MyApp.app/ResourceRules.plist" --entitlements "/../iSnagMobileiOS.xcent" "/../iSnagMobileiOS.app"
The file specified in the entitlements parameter contained the beta-reports-active key as expected:
<?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>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>XXXXXXX.com.mycompany.myapp</string>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXXX</string>
<key>beta-reports-active</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>XXXXX.com.mycompany.myapp</string>
</array>
</dict>
</plist>
I then retrieved the generated IPA, which was signed with my distribution certificate. In order to check that the correct entitlement had been applied, I executed this command to check the provisioning profile:
unzip -p MyApp.ipa Payload/MyApp.app/embedded.mobileprovision | security cms -D
Within the XML fragment I could see the entitlements dictionary which contained the flag as expected:
<key>Entitlements</key>
<dict>
<key>keychain-access-groups</key>
<array>
<string>XXXXXXXX.*</string>
</array>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>XXXXXXXX.com.mycompany.myapp</string>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXXXX</string>
<key>beta-reports-active</key>
<true/>
</dict>
There is also no extra Entitlements.plist file in the IPA that might be throwing this off.
I uploaded the IPA with Application Loader 3.0, but I then received this error message:
WARNING: ITMS-90191: "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."
I have found numerous hits while searching for this message but none seemed to describe the above the problem; all those users found that regenerating the profile and downloading it again was all that was required.
I wondered if I was perhaps experiencing an issue caused by an older version of XCode or MonoTouch but after I updated both, I still experienced the same problem. I'm going to guess that this issue is not caused by Xamarin but is perhaps caused by a setting I have overlooked in my build configuration, but I could be wrong there.

Enterprise app deployment doesn't install on iOS 8.1.3

After updating iOS 8.1.3, I tried to download, but getting error "Unable to download app" and "could not be installed at this time" messages appears.
What are changes between 8.1.2 and 8.1.3 which i have to take into consideration?
Download mode: < a
href="itms-services://?action=download-manifest&url=https://****.plist">
Thanks!
After a few hours wracking braincells, here's how I did it:
NOTE: I haven't currently tested this against iOS 8.1.2 or lower (proceed with caution!)
For apps that have ALREADY been signed with your OWN enterprise certificate, all you have to do (as mentioned by RAStudios in his edit) is to edit the manifest.plist:
Before:
<key>bundle-identifier</key>
<string>uk.co.acme.AcmeApp</string>
After:
<key>bundle-identifier</key>
<string>S836XXACME.uk.co.acme.AcmeApp</string>
For apps that have been signed by a third party that you're resigning with your enterprise certificate (this walkthrough is assuming the ipa file is AcmeApp.ipa, your entitlements file is entitlements.plist and your provisioning profile is provProvile.mobileprovision; all files are in the Desktop folder (Mac OSX), and S836XXACME is your team identifier):
Create a new entitlements.plist file:
<?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>S836XXACME.uk.co.acme.AcmeApp</string>
<key>get-task-allow</key>
<false/>
</dict>
</plist>
Unzip the ipa:
cd ~/Desktop
unzip AcmeApp.ipa
Remove the Code Signature:
rm -r Payload/AcmeApp.app/_CodeSignature/
Copy in the mobileprovision file:
cp provProfile.mobileprovision Payload/AcmeApp.app/embedded.mobileprovision
Codesign:
codesign -f -s "iPhone Distribution: ACME Corporation Limited" --entitlements entitlements.plist Payload/AcmeApp.app
Zip it up as the resigned ipa:
zip -qr AcmeApp_resigned.ipa Payload/
You also need to amend the manifest.plist file as per the 'ALREADY' signed part earlier:
<key>bundle-identifier</key>
<string>S836XXACME.uk.co.acme.AcmeApp</string>
After investigating..
Edit: After further testing, I found that simply matching the bundle ID in the Info.plist and the bundle ID in the manifest.plist worked for installing apps over-the-air on iOS 8.1.3. If this solution does not work, try the solution below.
Original Solution
Fix to the problem:
Your application must have a valid entitlements.plist, which includes correct the valid bundle identifier of an application.
If you are distributing an application signed with a iOS development certificate, here is an example of a entitlements.plist you should include with your app.
<?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>com.yourbundleidhere.mycoolapp</string>
<key>com.apple.developer.team-identifier</key>
<string>com.yourbundleidhere.mycoolapp</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>com.yourbundleidhere.mycoolapp</string>
</array>
</dict>
</plist>
If you are using a wildcard profile, replace com.yourbundleidhere.mycoolapp with yourwildcardappid.*. In both instances, you can use iResign to properly resign applications and include the now required, entitlements.plist.
Explanation of the problem
Due to security patches (see here under CVE-2014-4493), without the entitlements.plist, the application will not install. The security patch keeps applications from overriding existing apps and installing over the top of them/replacing them.
I've done quite a few experiments with this. In my experience the bundle identifier in the manifest.plist file isn't actually that critical. The most important thing to do is to get the entitlements.plist correct.
Rather than creating this manually I would recommend generating it from the provisioning profile using the following script (credit):
# Create an entitlements file
# parse provision profile
security cms -D -i "provProfile.mobileprovision" > ProvisionProfile.plist 2>&1
# generate entitilements.plist
/usr/libexec/PlistBuddy -x -c "Print Entitlements" ProvisionProfile.plist > Entitlements.plist 2>&1
You can then use this entitlements file with the --entitlements option on the codesign utility.
I have the same issue and this happens for the applications that doesn't have any entitlements.
Re-signing the app with entitlement solved the issue for me, but this is going to be pain as all the applications that are already deployed need to be re-signed and deployed.
This is a weird issue because these apps which failed for me doesn't use anything like keychain sharing or push notifications and hence doesn't need an entitlement at all (as per my understanding). Now when I just add an entitlement with keychain-sharing it starts working.
I have answered this here, this worked for me without having to do anything else
In addition to #Mark's and #RaStudio's answers, I have seen two more causes for the 'Unable to download application' message; one of which is new to iOS 8.1.3.
New failure cause on iOS 8.1.3
This error occurs when trying to install an application that has an expired provisioning profile. When signing an application, both the certificate and the provisioning profile must be valid and not expired. It seems as though an application with an expired provisioning profile and non-expired certificate can be installed on iOS 8.1.2 in some circumstances. Ensure that the provisining profile is not expired by going to Apple's developer center.
Old failure cause
This error occurs when trying to download an application signed with a development certificate and provisioning profile if the device has not been added to the development provisining profile on Apple's developer center.
I have sovled this problem.
Since Apple has changed provisioning profiles, please RENEW the provisioning profiles (File 1) and copy it into the "Payload/".
Make sure there's a Entitlements.plist (File 2) in the "Payload/", and this plist file MUST be PLAIN TEXT which is created by a text editor.
Make sure there's a Info.plist (File 3) in "Payload/", and this is created by XCode;
Copy the Entitlements.plist (File 4) anywhere else except the "Payload/".
Be sure "Bundle identifier" in File 1-4 should be the same.
Use this Entitlements.plist (File 4) to Re-Sign the IPA file.
You can resign it like this
codesign -fs "iPhone Distribution: Your Company Name" --entitlements=/Users/SenTR/Downloads/codesign/Entitlements.plist /Users/SenTR/Downloads/codesign/Payload/Your_Project_name.app
Entitlements.plist sample
<?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>PREFIX.yourappBundleID</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>PREFIX.yourappBundleID</string>
</array>
</dict>
</plist>
If you know Chinese, this will be helpful.
http://hennry.com/2015/03/fail-to-resign-ipa-since-ios8/
ios 8.1.3: inhouse app need distribute with MDM.
MobileInstallation
Impact: A malicious enterprise-signed application may be able to take control of the local container for applications already on a device
Description: A vulnerability existed in the application installation process. This was addressed by preventing enterprise applications from overriding existing applications in specific scenarios.
from apple release note

Adobe Air iOS Invalid Bundle The bundle does not support the minimum version os specified in info.plist

I got this error and thought I'd share the answer, as it was only due to years of Adobe Air for iOS development I could solve the problem. :)
If you, when uploading through Application Loader get an error like:
Invalid Bundle The bundle does not support the minimum version os specified in info.plist
You can simple add
<key>MinimumOSVersion</key>
<string>6.0</string>
into your AppName-app.xml manifest into "InfoAdditions" section.
This was the first thing I've tried. But this didn't help me to get rid of this error...
UPD: Just found here:
Hi,everyone.
I have the same warning too. But I was just resolved.
As a result of the update to the latest version of Mac OSX(10.9.5)
that is installed in the Application loader, it came to success.
I don't know this reason. Please try.
Can anybody check if this really helps? Also it would be good to check both cases - with default MinimumOSVersion and with set to 6.0 (for example).
To solve the issue you should add
<key>MinimumOSVersion</key>
<string>6.1</string>
(or higher)
AND
make sure the extensions you use have the same (or higher) MinimumOSVersion value in theirs manifests!
If no - you should update extensions or "hack" a bit their manifests.
I use latest release AIR SDK.
UPD: Latest AIR SDK Beta fixes loader error "Invalid Segment Alignment"
To solve (on Mac OS X):
Rename myapp.ipa to myapp.zip
Unzip
Go to the created "Payload" folder
Right click myapp.app and click "Show package content"
Open info.plist in a text editor
Change the value string of MinimumOSVersion to (at least this is what I put in, and it works)
<key>MinimumOSVersion</key>
<string>6.0</string>
Save the file and exit
Right click the Payload folder and click "Compress 'Payload'"
Rename back Payload.zip to myapp.ipa (where myapp is the original name of your ipa)
You have now solved this problem, however you may get an error when uploading, that the code signing is not messed up. I could upload OK but then when I went to the Prelaunch section of itunesconnect, it said "Invalid Binary" after 15 minutes.
In this case, also complete the following steps:
Create a file called Entitlements.plist in the same folder as your ipa, with the following content:
<?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>XXXXXXXX.com.my.app</string>
<key>keychain-access-groups</key>
<array>
<string>XXXXXXXX.com.my.app</string>
</array>
</dict>
</plist>
Where XXXXXXXX is your team(?) code in your Distribution Certificate KeyChain Access, and com.my.app is your app's app ID.
Then run the following code in the terminal
/usr/bin/codesign -f -s "iPhone Distribution: MyName Surname (XXXXXXXX)" "--resource-rules=./Payload/MyApp.app/ResourceRules.plist" --entitlements "Entitlements.plist" "./Payload/MyApp.app"
These steps should of course be taken before the last two steps above :)
UPLOAD and it should work!
I updated macosx to 10.9.5 and also changed my infoadditions on application xml to:
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>MinimumOSVersion</key>
<string>6.0</string>
]]></InfoAdditions>
After that, the application loader uploaded my ipa with no errors.

Application failed codesign verification. (Flash developed Iphone App)

I've developed my first App with Flash CS6 and not with Xcode. the App was tested on actual Iphone 4, 4s and 5 devices. it's bug free and ready for distribution. I've created both distribution certificate and provisioning profile. Both are applied in the publish setting in Flash CS6 and made sure in the deployment I've selected Deploy for App Store. now to upload the App to the app store i've already did all what is needed to be done in Itunes Connect and the status over there is "waiting for upload". to upload the app I'm using the Application Uploader that's included in the package of Xcode. So I've created the required Archive.zip and proceeded to the upload and get the following error:
Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate.
what did I miss? Please help! thanks :)
Thanks for your comment. I've actually found the solution that might help others in this situation. here are the steps that i've done:
I went to Xcode and created a fake project. it automatically generates a .plist file and i've erased the content and replaced it with this:
<!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>5GJX4765WZ.com.bobjt.largeimagesupport</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>5GJX4765WZ.com.bobjt.largeimagesupport</string>
</array>
</dict>
</plist>
Next I've opened the terminal and used this commanded to replace the old .plist that flash created with the new one:
codesign -f -s <your code signing identity> --resource-rules ./Payload/MySampleApp.app/ResourceRules.plist --entitlements ./MyEntitlements.plist ./Payload/MySampleApp.app
at this point it should replace it and if by any chance you encountered an error that states invalid file format... Make sure to download the latest Xcode and type this command :
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"
and that's it :) cheers to all

Resources