Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27419] Ti.Contacts.getAllPeople() fails on iOS 13

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2019-10-08T22:15:48.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.2.1
ComponentsiOS
LabelsengSchedule, ios
ReporterNick Kemp
AssigneeVijay Singh
Created2019-09-22T23:06:08.000+0000
Updated2020-10-08T08:18:35.000+0000

Description

Apple have added a new entitlement com.apple.developer.contacts.notes which allows apps to access the notes field of the contact db. The new entitlement is on a per app basis with developers required to put their case to Apple to gain it. Titanium requests CNContactNoteKey as part of the Ti.Contacts.getAllPeople method. This triggers a CNErrorDomain error 102. Any app compiled for iOS 13 without this entitlement will not be able to use the Ti.Contacts module for anything; regardless of needing the notes field. To test create an empty project with the following in tiapp.xml NSContactsUsageDescription Contacts test Add the following to alloy.js var people = Ti.Contacts.getAllPeople(); error in console

Comments

  1. Nick Kemp 2019-09-22

    I have tested removing references to CNContactNoteKey on 8_2_X branch and can confirm without this key everything is fine. I guess you will need to come up with a way to let users request access with/without the notes field on iOS.
  2. Vijay Singh 2019-09-26

    [~nickkemp] Thanks for raising the issue and detailed investigation. I think we can introduce a new property "Ti.Contact.includeNote" which need to be set before other API calls on Ti.Contact. If one do not need 'note', just set Ti.Contact.includeNote = false; Default value of Ti.Contact.includeNote will be 'true' to avoid breaking change. From next major release we'll make default value 'false'. Let me know if you have any other thoughts. Thanks!
  3. Vijay Singh 2019-09-27

    PR (master) - https://github.com/appcelerator/titanium_mobile/pull/11247 PR (8_2_X) - https://github.com/appcelerator/titanium_mobile/pull/11248 Test Case -
       Ti.Contacts.includeNote = false;
       var people = Ti.Contacts.getAllPeople();
       
    Run above test case on iOS 13, it should not log any error message in console.
  4. Satyam Sekhri 2019-10-04

    FR Passed Fetching of contacts works without error when Ti.Contacts.includeNote is set to false.
  5. Satyam Sekhri 2019-10-04

    Waiting for jenkins build on 8_2_X to merge
  6. Christopher Williams 2019-10-08

    Merged to master and 8_2_X
  7. Satyam Sekhri 2019-10-08

    Verified On: Mac OS: 10.14.5 SDK: 8.2.1.v20191008121020, 8.3.0.v20191008081818 Appc CLI: 7.1.1 JDK: 1.8.0_162 Node: 10.5.0 Studio: 5.1.4.201909061933 Xcode: 11.0 iOS Device: iPhone X(13.0)

JSON Source