2

I am developing an iOS chat application using Swift 3. When the app is launched for the first time it fetches all contact numbers from device using new Contacts API and sends those numbers to a server. The server returns a subarray of those numbers which are users of the app. Now how can I save those numbers?

1) Should I add them to application only memory (like sqlite DB)?

2) Should I add them again (as those numbers already exist in device contacts) to Contacts?

3) Should I modify the existing contact (like WhatsApp does)?

During my research and reading documentation I read about two things for CNContact:

a) CNInstantMessageAddress

b) CNSocialProfile

Now I updated the contact and CNInstantMessageAddress using this method.

let buzz = CNLabeledValue(label: "Buzz", value: CNInstantMessageAddress(username: "Buzz", service: "Buzz"))

This adds a new field in that particular contact but it does not open my App if tapped like WhatsApp does. So I think I am missing some part or maybe on the wrong track.

I have searched for how to create custom CNInstantMessageAddress and not use the predefined services like CNInstantMessageServiceSkype or CNInstantMessageServiceYahoo but I cannot find a single example or even any documentation about how to add custom CNInstantMessageAddress.

Any code example, link or any discussion would be helpful and will be appreciated. If I am doing this completely wrong, please guide me.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • Have you found anything about this? I'm developing a chat app too but I'm stuck in the register process. How do you match the phone numbers if a user can have the number with a country code or without it? – Rafael Jimeno Oct 30 '17 at 16:32
  • @RafaelJimeno i am still out of luck. have you find any solution or helping material or did you changed your approach? – Zeeshan Badshah Sep 07 '18 at 11:28

0 Answers0