Entitlements are not valid

后端 未结 17 2376
野的像风
野的像风 2020-12-01 00:47

Recently, I have upgraded my iPhone SDK OS from version 2.2.1 to 3.0 version. After that, while building my application, I get an error that the provisioning profile has exp

相关标签:
17条回答
  • 2020-12-01 01:41

    An Entitlements.plist file is required for testers to install ad-hoc builds. The default iOS templates don't include one. In XCode 3.2.4 you create one like this:

    1. From the menu, choose "File > New File…"
    2. Under iOS Templates, there's a Code Signing section. Choose the certificate icon named Entitlements. Name the file "Entitlements.plist"
    3. Select Entitlements.plist in your source tree.
    4. Choose "View > Property List Type > iPhone Entitlements Plist"
    5. Add a new key to the property list (select the top line, press return)
    6. The item will probably be named "Can be debugged". If not, choose that from the available options. This is equivalent to "get-task-allow".

    If you don't yet have one, create an 'ad-hoc' build profile:

    1. Select your target in the source tree.
    2. From the menu, choose "File > Get Info"
    3. In the inspector. select the "Build" tab.
    4. Under 'Configuration', choose "Edit Configurations…'
    5. Select your 'Release' configuration, click 'Duplicate' at the bottom of the screen.
    6. Rename the new configuration "Ad-Hoc Distribution"

    Now you've created an Entitlements.plist, you need to add it to your build settings.

    1. Select your target in the source tree.
    2. From the menu, choose "File > Get Info"
    3. In the inspector. select the "Build" tab.
    4. Make sure the configuration selector is set to "Ad-Hoc Distribution"
    5. In the "Code Signing" group, change the value of "Code Signing Entitlements" to "Entitlements.plist" - XCode may have put in a relative path for you. If so, change it.

    Note - you'll have errors installing the app on your own device if you build & run with "Code Signing Entitlements" set for other build configurations.

    Finally, check that the Entitlements.plist has been added to your target.

    1. Select Entitlements.plist in the source tree.
    2. From the menu, choose "File > Get Info".
    3. Select the "Targets" tab.
    4. Make sure the checkbox next to your target is checked.

    You should now be able to distribute your ad-hoc builds without this error.

    Most of this was gleaned from Apple's Managing Application Entitlements Guide, the rest by trial & error.

    0 讨论(0)
  • 2020-12-01 01:41

    I had this same problem, using Xcode 4. It turned out to be caused by a wrong selection for Identity in the "Share..." dialog in the (Archives section of the) Organizer. The correct selection (for me) is: "Don't Re-sign".

    0 讨论(0)
  • 2020-12-01 01:46

    From the docs:

    Building an app for Ad Hoc distribution is similar to building an app for App Store distribution, with an exception of two additional steps. First, you need to create an Ad Hoc Distribution Provisioning profile and add the UDIDs of the iOS devices that you want to distribute to using the iPhone Developer Program Provisioning Portal. Second, you need to create a code-signing Entitlements file. For information about how to create an Entitlements file read the Managing Application Entitlements section of the iOS Development Guide.


    Managing Application Entitlements

    iOS provides access to special resources and capabilities—such as whether your application can be debugged—through properties called entitlements. To specify entitlement information in your application, you add an entitlement property-list file containing entitlement definitions (key/value pairs) to your project. When you build your application, Xcode copies the file to the generated application bundle.

    To add an entitlements property-list file to your project:

    In the Groups & Files list, select the Resources group. Choose File > New File. Choose the iOS > Code Signing > Entitlements template. Name the file Entitlements.plist. (You can use any name; just ensure it matches the value of the Code Signing Entitlements build setting, as explained later in this section.) Set the type of the property-list file to iPhone Entitlements. With the file selected in the text editor, choose View > Property List Type > iPhone Entitlements plist.

    Add your entitlement entries to the file. For each entitlement property you need to define:

    Click the Add Child or Add Sibling buttons to the right of the selected row. The Add Child button has three lines depicting a hierarchy, the Add Sibling button has a plus (+) sign on it. Choose the entitlement property from the pop-up menu that appears. If the entitlement you need to add doesn’t appear in the menu, choose View > Property List Type > Default for File Type. Then enter the entitlement-key name and type.

    Enter the value for the property. Set the Code Signing Entitlements build setting for the target to the name of the newly added entitlements property-list file.


    Once you have created your Entitlements file and added it to your Code Signing Entitlements build setting, open the Entitlements file and add or edit the get-task-allow key and set it to false.

    In addition to compressing your .app bundle to distribute your Ad Hoc build to testers, etc. it is recommended that you also compress the provisioning profile before distributing because certain email clients and servers may corrupt the provisioning profile.

    For information about Ad Hoc distribution please read the Publishing Applications for Testing section in the iOS Development Guide.

    0 讨论(0)
  • 2020-12-01 01:50

    Be sure that when you 'Build and Archive' that you are building for 'Device' and your configuration is not 'Debug'. It will seem to create the archive correctly, but will fail upon installing the .ipa the device if you are set to a Debug profile when you do the 'Build and Archive'.

    0 讨论(0)
  • 2020-12-01 01:51

    I had this in XCode 4. I tried cleaning, deleting and recreating the entitlements file but still no joy. Then I changed the Value for "Can be debugged" from YES to NO .. and it worked. Anyway it seems to work fine now, I hope this helps!

    0 讨论(0)
提交回复
热议问题