Adding entitlement file - iphone

I need to submit my app to the App Store. So before I do this, I validated my application using Xcode's validate process.
When submitting for Validation, it required a entitlement file to be added to the project. I was unable to create this file so I dragged an entitlement file from another project and included in mine. This entitlement file did not contain any data in it (it was an empty file). However when I submitted it to validation through Xcode the validation passed successfully.
What I want to know is, What does a entitlement file do (since the entitlement file included in my project is empty) and will my app get rejected from appStore for dragging and dropping an entitlement file from another project?

According to Apple Reference
Entitlements confer specific capabilities or security permissions to your app.
Specifically
Set entitlement values in order to enable iCloud, push notifications, and App Sandbox (App Sandbox is Mac OS X only). Each entitlement has a default value, which in most cases disables the capability associated with the entitlement. When you set an entitlement, you are overriding the default by providing an appropriate key-value pair
Entitlement file is just a plist file, you can see it as another setting file that include a few highlevel configuration and is essential for code-signing an adhoc build prior to xcode 4.x
Empty entitlement file is valid as XCode will treat empty entitlement file as you want to use all the default value specified by Apple's reference. Leaving an entitlement file in your app project won't cause any harm, unless you specify something that your app is not capable of , i.e. icloud storage. Better to just delete that file if you don't need local distribution. :)
According to Apple Technical Note TN2250 (I recommend you to get rid of the entitlement file)
If you are defining a custom Code Signing Entitlements file within
your Target > Build Settings, you might try removing that
configuration entirely and rebuilding/resubmitting. More often than
not, Code Signing Entitlements are defined unnecessarily. You only
need to specify a custom Code Signing Entitlements file if your
application is utilizing custom keychain access sharing or iCloud.
Otherwise, remove the Code Signing Entitlements configuration from all
build configurations on your Xcode project's Target > Build Settings,
the rebuild and reattempt your submission/validation.
Specifying a code signing entitlements file unnecessarily is the most
likely cause of errors such as -
The app 'Foo' was not installed on the iPhone "foobar's iPhone"
because the entitlements are not valid.
In most cases, those entitlements seen above should be the only
entitlements in your App's Signature. Applications using Apple Push
Notification or iCloud will add a couple entitlements. Otherwise,
extra entitlements than those listed above, or improperly spelled, or
formatted versions of those entitlements will likely result in "failed
codesign verification" preventing upload to the store, or for Ad Hoc
builds produce the iTunes installation error 'the application was not
installed because the entitlements are not valid'.
Please see Reference

Related

invalid binary, email received

I'm trying to upload an app to app store, and I'm getting a lot of trouble.
Now I received this email:
Dear developer,
We have discovered one or more issues with your recent delivery for "usualBike". To process your delivery, the following issues must be corrected:
Invalid Code Signing Entitlements - Your application bundle's signature contains code signing entitlements that are not supported. Please check your Xcode project's code signing entitlements configuration, and remove any unneeded entitlements.
Specifically, key "com.apple.developer.default-data-protection" is not supported.
Invalid Code Signing Entitlements - Your application bundle's signature contains code signing entitlements that are not supported. Please check your Xcode project's code signing entitlements configuration, and remove any unneeded entitlements.
Specifically, key "com.apple.developer.pass-type-identifiers" is not supported.
Once these issues have been corrected, go to the Version Details page and click "Ready to Upload Binary." Continue through the submission process until the app status is "Waiting for Upload." You can then deliver the corrected binary.
Regards,
The App Store team
The second one I found this:
Invalid binary in itunes connect
But i have iOS 5.1
This probably means that you have Data Protection and Passes enabled for your App ID in the iOS provisioning portal. This is not supported for iOS 5.1
You should disable this by:
Going to the iOS provisioning portal
Open the App ID tab
Click configure next to the App ID you're currently using
Unselect the Enable for Passes and Enable for Data Protection options
Redownload the provision for your application and rebuild it using this new provision.

Selecting "Enable Entitlements" for iCloud causes codesign error, even with correct distribution provisioning profile

I have updated and rebuilt my app with a new provision profile that was configured with "Enable for iCloud" checkbox selected in the provision portal.
Next, in XCode, for the app project, I selected the box for "Entitlements" in Targets->Summary->Entitlements as shown below to support iCloud. However, as soon as I add this, I am unable to build the application as I get the dreaded
warning: Application failed codesign verification. The signature was invalid, or it was not signed with an iPhone Distribution Certificate. (-19011)
The app builds successfully with NO codesign errors and installs onto hardware with the proper provisioning profile when the "Enable Entitlements" is unchecked. As soon as I check it, it gets the codesign error.
I also tried updating the entitlements file with ABCDEF.com.myapp (with my real iCloud ID and app id) for the com.apple.developer.ubiquity-container-identifiers value.
What am I doing wrong? Any help is greatly appreciated!
Btw, I wrote a blog post with a solution which could be helpful.
You may try to copy and paste the <dict> of key entitlements from your provisioning profile to your.entitlements (a plist) file.
iCloud Gotchas
Finally, I found the solution. It ended up being a Apple Provisioning Portal issue.
Even though I followed these steps:
1. Selected "Enable for iCloud" for the App ID
2. Created(regenerated) a new provision profile that was configured for the respective "Enable for iCloud" app
3. In XCode, for the app project, I selected the box for "Entitlements" in Targets->Summary->Entitlements as shown below to support iCloud.
The build error still persisted. So, I looked at the Prov Prof with an editor and the entitlements were NOT in there even though I just generated a new one.
What I found was after about 1 week, surprise!, if I generated the Prov. Profile now it had the entitlements in it! So, there was a delay before the generation of the PP's would pick up the iCloud entitlements. Also I filed this issue with Apple so they are aware of this strange delay.

Cannot create correct ad hoc build of app

I am trying to distribute my application to a beta tester. I believe that I have followed the ad hoc distribution process to a T but I my tester is having issues when trying to install. The error being "Could not install, invalid entitlements" or something to that effect. I have generated a distribution certificate. I have generated a ad hoc provisioning certificate referencing my distribution certificate, my app id, it's marked as an ad hoc distribution and the devices are selected (I regenerated just to be sure). I downloaded the certificate and profile and installed in Xcode and the keychain as needed. My app id in the info.plist is the same as the one in the profile (with the exception of the 10 character Apple generated prefix).
I went to Xcode and created a dist.plist and unchecked the get task allowed value. I created an Ad hoc distribution configuration and set the code signing identity to the one I just down loaded. Build clean. Build and archive. Shared it using Organizer. Emailed the .IPA and the mobileprovision file to the beta tester. It is probably a forest for the trees type of thing.
And that's where my tragic story ends. I've read everything I can find and I appear to be following the steps. Obviously I am missing something.
is the 'Application requires iPhone environment' checked in your info.plist?
are you sure you are using correct provision profile?
Make sure all the steps you entered has performed correctly, as you already mentioned forest of trees.
One thing you are missing is to set the
Code signing entitlements in you project's settings
you have to set its value to your entitlements file name as in your case dist.plist
so set Code signing entitlements = dist.plist in your projects settings.
Wish you good luck!

invalid entitlements 0xE8008016 when I add the entitlements file

I'm trying to do ad hoc distribution. When I use XCode, the application installs fine on my phone.
In preparation for ad hoc distribution, I created the default entitlements file, unchecked the get-task-allow box, added the entitlements file name to the code signing entitlements line, and tried to install on my phone.
If I have the file in the entitlements in build settings, I get the (dreaded) error
The entitlements specified in your application's Code Signing Entitlements file do not match those specified in your provisioning profile.
(0xE8008016).
This ONLY happens if I have the entitlements file listed in the code signing section.
I created a brand new application to test this, to see what could have gone wrong and this happens with a completely new test application (so it doesn't seem like clean builds, opening and closing XCode, etc will help).
What am I missing? I've read all of the other times this has occurred and nothing seems to apply.
You need to follow these steps
Have you changed the bundle identifier in your project's info.plist???
Please make sure that this also matches with your provisioning profile's identifier.
go to your projects info. select the configuration you want your build to be deployed then check in build settings that you have added the dist.plist file and the provisioning profile is the same thta you need to run with.
If you are making the build for distribution then set the get-task-allow mark as unchecked
Hope this helps.
I've made it! The reason is you got wrong Certificates! If you're using development Certificates, you can't use the distribution Certificates.
Do the following steps:
Remove the provisiong file from the Xcode -> Organizer
Download again from your developer account. Make sure that you have downloaded profile from distribution tab.
Drag and drop that profile to Xcode
Change the bundle identifier of your plist that match with your provisioning profile App ID.
Go to application setting target and active target and choose your profit from there.
Now rebuild and run the app.
It's also worth noting that this problem may be rooted in trying to install properly authored programs on Jailbroken devices. At least in my case, all my development units and I kept getting this error. By adding the get-task-allow BOOL type to a Entitlements.plist file, I still got the error but the files were installed on the devices (live debugging doesn't work though).
Have you checked that the Code Signing Identity values under Project > Build Settings and Targets > Build Settings are correct?
I found I had to add the new device I was testing on to my Provisioning Profile, on the IOS Provisioning Profile Site.
I had not agreed to the new updated licensed agreement from apple.
Briefly :
Please log in to your developer's account -> profile's -> review -> read the agreement or get your lawyer read it for you -> agree (at your own will) -> and again click profile's to check the status of your profile.
In my scenario the valid code signing entity was not showing up. When i followed the above procedure it was visible and i was able to run the app on the device and/or create the iPA file without much difficulty.
For what its worth, I had this issue with one app but not another. Seems the "Provisioning Profile" in Target->BuildSettings->Code Signing had to be set to "Automatic". If you selected one of the ones in the list it failed with this error.
me too got this type of error, i resolved this by deleting current Entitlement.plist and adding new Entitlement.plist.
Because the project i was trying to run was build on 3.2 sdk and current i am using 4.2.
That was the only reason i was getting error
It seems this error code is used for many situations. In my case, the problem started to happen after we set our DataProtectionClass to NSFileProtectionComplete. I'm not sure of the fix yet.
Removing the entitlement wasn't and option for me as I wanted to use "iCloud", so after digging a little I found that the problem was that "iCloud" not being enabled on the app configuration on the "iOS Provisioning portal".
Enabling it and regenerating the provisioning did the trick for me.
My issue was that the Distribution Profile was created as Ad hoc rather than In House making the device I was running the app on not accept it.
Make sure that the device is added to the Provisioning Profile or create an Enterprise Profile.
Another pitfall while trying to correct this error: you'll also need to replace provisioning profiles from embedded extensions.
In my case, the provisioning profile of my iOS app was just fine. It took me hours to figure out that the provisioning profile of my widget (or Today Extension) needed an update, due to a new device to test on.
Make sure you check all relevant and related targets, not only the target you're trying to execute.
Go to Target -> Capabilities - > Associated Domains
Press Fixed issue Button
Run Project

Not Jailbroken - getting Provisioning is not applicable for product type 'Application' in SDK Device

Codesign warning: provisioning is not applicable for product type 'Application' in SDK Device - iPhone OS3.1'; ignoring..
Redownloaded my developer certificate, made a new provisioning profile, still getting this error. Searched the Xcode project and removed all lines referencing a Provisioning Profile, but that didn't seem to remove it from the project settings (went to show package contents, then opened the project file).
Was originally on a different machine then transferred over, if that makes a difference?
Thanks
Check the file
/Developer/Platforms/iPhoneOS.platform/Info.plist
and make sure the following keys are set to YES
<key>PROVISIONING_PROFILE_ALLOWED</key>
<string>YES</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>YES</string>
When developing for a jailbroken devices, these should normally be set to NO, so you can self sign and copy the file over, etc, but it's not necessary to skip this when you actually have a proper certificate and provisioning for your device.