3

I have an app that from some reason needs to assign a custom date to the user contacts, The app was out and worked fine. Now I wish to build a swift version of the app.

While testing it on xCode 6, iOS7 + 8 everything looks great, but when testing in a device I see that the date is added as the Anniversary date of the user and without my custom label.

I tried to add the date directly in the native Contacts app and found that new contacts does not have an option to add a custom date.

Testing on Yosemite I still find this option available.

When checking the ABPerson API I found that the API still has the kABMultiDatePropertyType

// Dates
AB_EXTERN const ABPropertyID kABPersonDateProperty;              
// Dates associated with this person - kABMultiDatePropertyType

It is important to note that when saving the new date I do not get any Error and the date is saved but without my custom label which is important as I do not want to override the user Anniversary date.

Any idea why this is happening / any workaround ?

shannoga
  • 19,649
  • 20
  • 104
  • 169
  • did you check the documentation for this? There doesn't seem to be anything documenting this particular value within the newest iOS Xcode API documentation. There is a kABDateProperty and kABMultiDateComponentsProperty that you can use though. – TheCodingArt May 14 '15 at 19:09
  • I confirm `kABPersonDateProperty` is still defined in iOS 8.3 SDK in file "ABPerson.h" on line 131. – Nicolas Buquet May 14 '15 at 19:45
  • @TheCodingArt as Nicolas mentioned, the documentation still mentions kABPersonDateProperty, I do not get any error if I try to assign the date it just won't save it. – shannoga May 14 '15 at 19:57
  • What is the contact source? ActiveSync? iCloud? Certain properties are not saved for certain source types. – Léo Natan May 14 '15 at 20:08
  • @LeoNatan I am not sure I understand you, but this is a new contact created in the app itself. – shannoga May 14 '15 at 20:09
  • I mean the `ABSourceType` value. – Léo Natan May 14 '15 at 20:12
  • @LeoNatan I do not specify it, what is the default ? – shannoga May 14 '15 at 20:13
  • The default is according to the device accounts. It's a mess, and I suggest you study how different sources exist/interop, and what data can be saved for each type. – Léo Natan May 14 '15 at 20:14
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/77842/discussion-between-shannoga-and-leo-natan). – shannoga May 14 '15 at 20:15
  • I would like to point out that if something is in the header file, but not in the documentation, it's probably something that's currently unsupported. There being a header file value does not in any way confirm existing functionality. – TheCodingArt May 15 '15 at 20:22
  • 1
    Interesting challenge but I think I would need more to chew on. Can you post the Obj-c that works. On occasion I have found that bridging to Obj-c (if it is still supported in Obj-c) is the quickest way to get familiar functionality to work and this might be that kind of situation. But first I would really need to see what code worked and then recode it in swift. – Christopher Wade Cantley May 18 '15 at 16:43

0 Answers0