[TIMOB-27419] Ti.Contacts.getAllPeople() fails on iOS 13
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-10-08T22:15:48.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.2.1 |
Components | iOS |
Labels | engSchedule, ios |
Reporter | Nick Kemp |
Assignee | Vijay Singh |
Created | 2019-09-22T23:06:08.000+0000 |
Updated | 2020-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
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.
[~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!
PR (master) - https://github.com/appcelerator/titanium_mobile/pull/11247 PR (8_2_X) - https://github.com/appcelerator/titanium_mobile/pull/11248 Test Case -
Run above test case on iOS 13, it should not log any error message in console.
FR Passed Fetching of contacts works without error when Ti.Contacts.includeNote is set to false.
Waiting for jenkins build on 8_2_X to merge
Merged to master and 8_2_X
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)