Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19911] iOS: Set Entitlements.plist keys from tiapp.xml like we do for Info.plist

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-12-22T14:13:51.000+0000
Affected Version/sRelease 5.0.2
Fix Version/sRelease 6.1.0
ComponentsiOS, Tooling
LabelsCapabilities, ios
Reporter Ricardo Ramirez
AssigneeChris Barber
Created2015-11-11T02:51:46.000+0000
Updated2017-01-24T22:35:28.000+0000

Description

Currently the only way to add e.g. associated domains for [Universal Links](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW1) or the HealthKit entitlement for the [HealthKit Module](http://labs.appcelerator.com/project/55c3c788e014044625e9b2a1/HealthKit-Module) is by using a custom Entitlements.plist file in the project root:
<key>com.apple.developer.associated-domains</key> 
     <array> 
          <string>applinks:mydomain.com</string> 
     </array> 
The problem is that the Entitlements.plist if you do so Titanium [will no longer automatically add](https://github.com/appcelerator/titanium_mobile/blob/17dc8754653daaff170ea0c18f74218168a5633e/iphone/cli/commands/_build.js#L2219-L2258) any other require entitlements, like TIMOB-19311. What we need is for this to work exactly [like we handle](https://github.com/appcelerator/titanium_mobile/blob/17dc8754653daaff170ea0c18f74218168a5633e/iphone/cli/commands/_build.js#L1939) Info.plist:

Load/Create our default Entitlements.plist.

Merge custom Entitlements.plist in the project root.

Merge keys set in tiapp.xml under <ios>/<entitlements>

Do whatever we automatically generate, but only if the key does not already exist (alternatively, do this step after the first so it will be overwritten by the user's keys)

Ideally we would rename <ios>/<plist> to <ios>/<info> but that would break all apps ;)

Comments

  1. Fokke Zandbergen 2015-11-12

    [~rramirez] I updated the ticket to address the actual need to be able to customise Entitlements.plist via tiapp.xml. /CC [~cbarber]
  2. Hans Knöchel 2016-09-02

    Good ticket. I would use the <entitlements/> tag instead of renaming the plist key afterwards. The behavior could be duplicated 1:1 from how we currently handle the Info.plist-merge.
  3. Martin Williamson 2016-09-16

    Would really like to see this now cert entitlements are no longer merged in xcode 8
  4. Chris Barber 2016-09-20

    [~rramirez] Nope. Tied up with TIMOB-23908, TIMOB-23518, and TIMOB-23786. All of which are critical. I'll get to this ticket when I get to it.
  5. Chris Barber 2016-12-21

    Ti SDK master PR: https://github.com/appcelerator/titanium_mobile/pull/8708 To test, add the following to your tiapp.xml:
       <ios>
           <entitlements>
               <dict>
                   <key>com.apple.developer.associated-domains</key> 
                   <array> 
                       <string>applinks:mydomain.com</string> 
                   </array>
               </dict>
           </entitlements>
       </ios>
       
  6. Lee Morris 2017-01-24

    Can confirm that this works fine and the console logs show no errors whatsoever. Tested with; iPhone 7 MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.1.0.v20170124071525 Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source